java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names mus...

java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens
    at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:428)
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:684)
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:806)
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1498)
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

Then it may need to be solved in the following two ways:

1. Tomcat's header buffer size is not enough, just add the maxHttpHeaderSize field in server.xml:

    <Connector URIEncoding="UTF-8" port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol"
useBodyEncodingForURI="false"
enableLookups="false"
               connectionTimeout="20000"

               redirectPort="8443" maxHttpHeaderSize="你想要的大小"/>
如果是SpringBoot项目,则需要在application.yml文件中,进行如下修改:
server:
  port: 项目端口
  # 下面这个参数是为解决问题而新增的
  tomcat:
    max-http-header-size: 8192

2. It may be because the request protocol is wrong and needs to be unified into https or http requests.

The request address is https, just change https to http.

Reference link: https://blog.csdn.net/yanguo110/article/details/71210131

PS:
Regarding the question of SQL querying the database.... Finally, when the where query is found, an extra " " is added when the query value is found. This is originally to convert it into a string, but it is not Note that there is an extra space in the middle, which wastes a long time.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324495678&siteId=291194637