遇到问题的情况
接口没有配置https,请求时用https会此异常。
其他情况
1、问题现象
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)
2、解决方案
- 和网络协议有关系。检查你的请求方式是否为https,是的话,修改为http。
- SSL的证书到期了
- Tomcat的 header 缓冲区大小太小,server.xml 文件可以加上maxHttpHeaderSize="8192"
<Connector port="8080" executor="tomcatThreadPool"
protocol="HTTP/1.1"
maxThreads="1000"
maxHttpHeaderSize="8192" - 修改端口号