Java – invalid character found in method name The HTTP method must be a token

This is not a repetition of other problems (or at least problems I have encountered), because I don't use SSL / HTTPS anywhere in the code I can also confirm that these errors come from my system rather than external sources (such as robots) If it's simple, I apologize. I only started using spring boot a few months ago

I am developing an Internet of things system. I send raspberry PI zero w with sensors to the site Raspberry PI obtains sensor data through Bluetooth le and sends the data to spring boot server (hosted on AWS EC2 instance) through HTTP Strangely, the server has no problem getting data for a period of time (in this case, 3 weeks), and then I suddenly get 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: more HTTP header parsing errors will be recorded at the debug level

java. Lang.illegalargumentexception: invalid character found in method name The HTTP method name must be a token at org apache. coyote. http11. Http11InputBuffer. Parserequestline (http11inputbuffer. Java: 421) ~ [Tomcat embedded core-8.5.11. Jar! /: 8.5.11] (the rest of the stack trace)

As I mentioned above, I do not use HTTPS in spring boot or raspberry PI Since raspberry Pi is deployed to a remote location, I will not change the code

The program running on raspberry Pi is written in Python. I use requests The post method sends the data to the server

I also noticed this behavior in the early deployment of the system, which uses Android devices to send data So I don't think the customer has any problems

I've done quite a lot of testing on the server, especially when I add new features. I've never encountered this error before (except in previous deployments) Once this error occurs, it just seems to continue (I lost 3 sensor readings in a row, all on different dates / times)

Is the data corrupted when leaving raspberry Pi? requests. Is there any strange behavior in post that I don't know? Will the code I write in spring affect Tomcat in some way? I don't know why. All the other answers I met said it was usually because of the HTTPS to HTTP connection My application The properties file has only server port = 80

Thank you very much for your help!

Solution

I have a similar question and add

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

Solved the problem for me

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>