Skip to main content
1-Visitor
January 19, 2017
Solved

Error parsing HTTP request by Thingworx on localhost

  • January 19, 2017
  • 2 replies
  • 46827 views

Hi, i'm installed Thingworx on localhost - Apache 9.0 , jre1.8.0_111, Thingworx version 7.2.1 - all setting as manual in Installing_ThingWorx_7.1_1.pdf.

1) Am i right when i wrote in apache server.xml file or not?

  <Connector executor="tomcatThreadPool"

               port="80" protocol="HTTP/1.1"

               connectionTimeout="20000"

               redirectPort="8443" />

<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"

            maxThreads="200" scheme="https" secure="true" SSLEnabled="true"

           clientAuth="false" sslProtocol="TLS"/>

2) I have a thing with the same properties and on thingworx.com my code work without problems, but on the localhost i can't take properties from my thing, in logs a have errors like

[19/Jan/2017:19:38:07 +0300] "POST null null" 400 -

[19/Jan/2017:19:38:09 +0300] "POST null null" 400 -

[19/Jan/2017:19:38:11 +0300] "POST null null" 400 -

and in catalina.log

19-Jan-2017 19:23:31.851 INFO [http-nio-80-exec-6] org.apache.coyote.http11.Http11Processor.service Error parsing HTTP request header

Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.

java.lang.IllegalArgumentException: Invalid character found in the request target. The valid characters are defined in RFC 7230 and RFC 3986

  at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:452)

  at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:667)

  at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)

  at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:745)

  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1437)

  at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

  at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

  at java.lang.Thread.run(Unknown Source)

what's wrong ?

my arduino's code in attachment

Best answer by dshaykhutdinov

I found the answer. The problem was in this symbols "<" and ">" in my arduinos code, it doesnt work on localhost, but works perfect when i'm use cloud.

And Apache Tomcat version must be lower than 8.5 versions. Maybe somebody it will help in future 😃

2 replies

20-Turquoise
January 19, 2017

One of the things to note right away - tomcat should be 8.0.X (recommended 33+ for minor version), 8.5 and 9.0 are currently not supported.

5-Regular Member
January 19, 2017

Damir, just to make sure, what is the language you've set for your OS? With an error like 'invalid character found', it usually refers to non compliant characters being sent (which can be fixed by adding specific encoding to your Java Opts).

Also, the current supported version of Tomcat is 8.0.xx, so you would need to downgrade/ re-install the correct version. The latest version I believe is 8.0.39.

1-Visitor
January 20, 2017

I'm using with Russian language with windiws-1251 charset. I re-installed Tomcat from 9 ver. 8.0.39 as you recomended. But i tooking the same problems

[20/Jan/2017:11:02:40 +0300] "POST null null" 400 -

20-Jan-2017 11:19:08.098 INFO [http-nio-80-exec-10] org.apache.coyote.http11.AbstractHttp11Processor.process Error parsing HTTP request header

Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.

In headers i'm adding client.println("Content-Type: text/html; charset=UTF-8") not works. How can i change charset in windows in my arduino's code ? 

5-Regular Member
January 20, 2017

Instead of adding it in the headers, try adding it to Tomcat's Java Options itself. Search for 'Configure Tomcat' or right click Tomcat's tray icon and hit 'Configure', navigate to the Java tab, and under Java Options add the following:

-Dfile.encoding=UTF-8

Once you do, please do restart Tomcat for the changes to reflect before retrying.