SpringBoot项目报错Invalid character found in method name. HTTP method names must be tokens解决办法

几天没开电脑,启动项目报错

报错信息:

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

中文释义:“在方法名称中发现无效字符。HTTP方法名称必须是令牌”

完整错误信息如下:

java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens
	at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:415) ~[tomcat-embed-core-9.0.24.jar:9.0.24]
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:292) ~[tomcat-embed-core-9.0.24.jar:9.0.24]
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-9.0.24.jar:9.0.24]
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:860) [tomcat-embed-core-9.0.24.jar:9.0.24]
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587) [tomcat-embed-core-9.0.24.jar:9.0.24]
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-9.0.24.jar:9.0.24]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_91]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_91]
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-9.0.24.jar:9.0.24]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_91]

 

错误分析:

错误提示信息中提到的了http协议,很有可能和网络协议有关系

解决办法:

默默的看了一下我的请求路径是:https://localhost:8888/demo/getAllUser  把https改成http,我的问题就解决了

 

注意:如果不能解决你的问题,那么可以参考以下网友的解决办法

Tomcat安装目录下server.xml中加上maxHttpHeaderSize="8192"(我用的SpringBoot内置的容器,所以没考虑这个办法)

至于其中原因我们可以讨论一番

坚信答案就在错误中

你可能感兴趣的:(java,java,Springboot,容器,http,https)