Invalid character found in method name. HTTP method must be tokens

This is not a duplicate of other questions (or at least the ones I ran into) 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 from an external source (like a bot). If this is something simple I am sorry, I just started using Spring Boot a few months ago.

I am developing an internet system of things in which I send a Raspberry Pi Zero W to a field with sensors. The Raspberry Pi receives sensor data via Bluetooth LE, and HTTP sends the data to the Spring Boot server (which is hosted on the AWS EC2 instance). Oddly enough, the server is getting data 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 Spring Boot or Raspberry Pi. Since the Raspberry Pi is deployed to a remote location, I am not changing the code.

The program running on the Raspberry Pi is written in Python and I am using a method requests.post

to send data to the server.

I noticed this behavior in an earlier system deployment that used an Android device to send data. So I don't think there is anything wrong with the clients ...

I've tested the server quite a bit, especially when I add new features, and I've never gotten this error before (other than a previous deployment). Once this error occurs, it seems like it keeps going on (I lost 3 gauge readings in a row, all on different days / times).

Is the data corrupted as it comes out of the raspberry? Does it have requests.post

some strange behavior that I am not aware of? Is the code I am writing with Spring affecting Tomcat in some way? I have no idea why this is happening and all the other answers I have come across usually say due to HTTPS-HTTP connection. My application .properties file only has server.port = 80

Thanks a lot for any help!

+4


source to share


2 answers


I had a similar problem and adding

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-databind</artifactId>
    <version>2.6.3</version>
</dependency>

      



fixed the problem for me.

0


source


#Increase header buffer size
#server.tomact.max-http-header-size: 8192   this is lose efficacy 
server.max-http-header-size=15360

      



-1


source







All Articles