java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens

匿名 (未验证) 提交于 2019-12-03 02:06:01

问题:

I am getting below stack trace when I am deploying my application in a multi-server Apache Tomcat 8 environment. I am getting this error frequently, and it seems it is blocking the tomcat thread:

INFO [http-nio-80-exec-4461] org.apache.coyote.http11.AbstractHttp11Processor.process Error parsing HTTP request header  Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.  java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens  at org.apache.coyote.http11.AbstractNioInputBuffer.parseRequestLine(AbstractNioInputBuffer.java:233)  at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1017)  at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1524)  at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1480)  at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)  at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)  at java.lang.Thread.run(Unknown Source)

Can any one direct me how to troubleshoot or narrow down such an exeption? I am not getting any reference to any of my application source files. I tried to google around, and in of the links it said, you are trying to access http url through https, which seems unlikely. I am not getting this error, when the application runs on a single Tomcat 8 instance. I get this only in a multi-server environment.

I am also sharing the meta tags I have embedded on each page, if that helps to identify the cause.

   

I am also using the following in a few pages, which basically is same as above:

Even if anyone helps in giving a direction to my troubleshooting attempt, that will be useful, as currently I have no idea, where to look into.

Thanks in advance.

回答1:

This exception can occur when you try to execute https request from client on endpoint which isn't https enabled. Client will encrypt request data when server is expecting raw data.



回答2:

I got the same exception when I locally tested. The problem was a URL schema in my request.

Change https:// to http:// in your client url.

Probably it helps.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!