Edit: I no longer work at this place, and we switched to node.js anyway, so I cannot verify if anyone's answers are correct. Please vote to close (just need one more).
This is not a duplicate of the other questions (or at least the ones I came across) because I don't use SSL/HTTPS anywhere in my code. I was also able to confirm that these errors are coming from my system and not an outside source (like a bot). If it is something simple then I apologize, I only started using Spring Boot a few months ago.
I am developing an internet of things system where I send a Raspberry Pi Zero W out into the field with sensors. The Raspberry Pi gets sensor data via Bluetooth LE, and HTTP POSTS the data to a Spring Boot server (which is hosted on an AWS EC2 instance). Strangely, the server gets data perfectly fine for a while (in this case, 3 weeks), and then out of nowhere I started getting this exception from Spring/Tomcat:
2017-06-03 06:17:07.508 INFO 19927 --- [p-nio-80-exec-8]
o.apache.coyote.http11.Http11Processor : 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 method name. HTTP method names must be tokens
at
org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:421) ~[tomcat-embed-core-8.5.11.jar!/:8.5.11] (rest of the stack trace)
As I mentioned above, I am not using HTTPS in either Spring Boot or the Raspberry Pi. Since the Raspberry Pi is being deployed to a remote location, I am not changing the code.
The program running on the Raspberry Pi is written in Python, and I use the requests.post
method to send the data to the server.
I noticed this behavior in an earlier deployment of the system as well, which used an Android device to send the data instead. So I don't think there is anything wrong with the clients...
I have tested the server quite a bit, especially when I add new features, and I never got this error before (except in the previous deployment). Once this error occurs, it seems like it just continues to happen (I lost 3 sensor readings in a row, all at different days/times).
Is data getting corrupted as it leaves the Raspberry Pi? Does requests.post
have some odd behavior I am unaware of? Does the code I write using Spring affect Tomcat somehow? I have no idea why this is happening and all of the other answers I came across say its usually because of an HTTPS to HTTP connection. My application.properties file only has server.port=80
Thank you very much for any help!
I had a similar issue and adding
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.3</version>
</dependency>
fixed the issue for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With