Tomcat:java.lang.IllegalArgumentException:在方法名称中发现无效字符.HTTP 方法名称必须是令牌 [英] Tomcat: java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens

查看:339
本文介绍了Tomcat:java.lang.IllegalArgumentException:在方法名称中发现无效字符.HTTP 方法名称必须是令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在多服务器 Apache Tomcat 8 环境中部署我的应用程序时,我得到了堆栈跟踪.我经常收到这个错误,它似乎阻塞了 tomcat 线程:

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)

谁能指导我如何排除故障或缩小此类例外的范围?我没有得到任何对我的任何应用程序源文件的引用.我试着用谷歌搜索,在它说的链接中,你试图通过 https 访问 http url,这似乎不太可能.当应用程序在单个 Tomcat 8 实例上运行时,我没有收到此错误.我只在多服务器环境中得到这个.

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.

<%
    response.setHeader("Cache-Control", "no-cache");
    response.setHeader("Cache-Control", "no-store");
    response.setDateHeader("Expires", 0);
    response.setHeader("Pragma", "no-cache");
%>


<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0">
<meta name="viewport" content="width=device-width, initial-scale=1">

我也在几页中使用了以下内容,与上面基本相同:

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

<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Expires" content="-1" />
<meta http-equiv="Cache-Control" content="private" />
<meta http-equiv="Cache-Control" content="no-store" />
<meta http-equiv="Pragma" content="no-cache" />

即使有人帮助指导我的故障排除尝试,这也会很有用,因为目前我不知道去哪里查看.

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.

推荐答案

当您尝试执行 HTTPS 时可能会发生此异常 来自未启用 HTTPS 的端点上的客户端的请求.当服务器需要原始数据时,客户端将对请求数据进行加密.

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.

这篇关于Tomcat:java.lang.IllegalArgumentException:在方法名称中发现无效字符.HTTP 方法名称必须是令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆