cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Error parsing HTTP request by Thingworx on localhost

dshaykhutdinov
1-Newbie

Error parsing HTTP request by Thingworx on localhost

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

1 ACCEPTED SOLUTION

Accepted Solutions

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 =)

View solution in original post

9 REPLIES 9

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.

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.

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 ? 

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.

i did it when installed tomcat as thw manual -Dserver -Dd64 -XX:+UseNUMA -XX:+UseConcMarkSweepGC -Dfile.encoding=UTF-8 in Java tabs in tomcat and after changes i'm restarted it again, where i could be wrong? Is thingworx supporting windows 10?

Hello Damir Shaykhutdinov​,

Yes, I have different Platform versions on Win10 and they are working fine. Is there a possibility for you to try to send any request to Thingworx without using Russian? Just to test if any request can be received by your Tomcat.

Regards,

J.

The first error was started here

23-Jan-2017 15:38:05.987 SEVERE [main] org.apache.tomcat.util.net.jsse.JSSESocketFactory.getStore Failed to load keystore type JKS with path C:\WINDOWS\system32\config\systemprofile/.keystore due to Illegal character in opaque part at index 2: C:\WINDOWS\system32\config\systemprofile/.keystore

java.lang.IllegalArgumentException: Illegal character in opaque part at index 2: C:\WINDOWS\system32\config\systemprofile/.keystore

Can you try using forward slashes to locate your .keystore file instead? The 'Illegal character in opaque' refers to backslash not being accepted.

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 =)

Top Tags