问题
在使用浏览器访问后端进行测试时,发现出现了以下异常:
java.lang.IllegalArgumentException: Invalid character found in method name [0x160x030x010x020x000x010x000x010xfc0x030x03_60xe20xa5Y0xeau0x17'u/0x860xc1]5l640x840xa1Q,0xa50x810x880xa1l0xf50x11]. HTTP method names must be tokensat org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:417)at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:261)at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:888)at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1597)at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)at java.lang.Thread.run(Thread.java:748)
解决方案
这个异常的意思就是在方法中有非法的参数,可我自己检查了后端接口,发现并没问题,于是我觉得问题应该出在请求上。果然,我发现我写的ajax请求地址写的是 https,可是我并没有加密,是无法用https协议的,将https改为http即可。特此记录。