1、错误信息
2014-7-15 2:46:38 org.apache.jk.common.MsgAjp processHeader
严重: BAD packet signature 18245
2014-7-15 2:46:38 org.apache.jk.common.ChannelSocket processConnection
严重: Error, processing connection
java.lang.IndexOutOfBoundsException
at java.io.BufferedInputStream.read(BufferedInputStream.java:306)
at org.apache.jk.common.ChannelSocket.read(ChannelSocket.java:620)
at org.apache.jk.common.ChannelSocket.receive(ChannelSocket.java:577)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:685)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:595)
2、原因,WEB请求访问端口不正确。也就是说在浏览器中输入的URL端口号是AJP协议的端口号,而不是WEB服务的端口号。
下面的例子中ARJ协议端口号为8009,真正的WEB服务端口号应为9000,所以,若使用8009访问,会出现上面的错误信息。
<Service name="Catalina">
<!--The connectors can use a shared executor, you can define one or more named thread pools-->
<!--
<Executor name="tomcatThreadPool" namePrefix="catalina-exec-"
maxThreads="150" minSpareThreads="4"/>
-->
<!-- A "Connector" represents an endpoint by which requests are received
and responses are returned. Documentation at :
Java HTTP Connector: /docs/config/http.html (blocking & non-blocking)
Java AJP Connector: /docs/config/ajp.html
APR (HTTP/AJP) Connector: /docs/apr.html
Define a non-SSL HTTP/1.1 Connector on port 8080
-->
<Connector URIEncoding="UTF-8" connectionTimeout="20000" port="9000" protocol="HTTP/1.1" redirectPort="8443"/>
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
-->
<!-- Define a SSL HTTP/1.1 Connector on port 8443
This connector uses the JSSE configuration, when using APR, the
connector should be using the OpenSSL style configuration
described in the APR documentation -->
<!--
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
-->
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>
<!-- An Engine represents the entry point (within Catalina) that processes
every request. The Engine implementation for Tomcat stand alone
analyzes the HTTP headers included with the request, and passes them
on to the appropriate Host (virtual host).
Documentation at /docs/config/engine.html -->
<!-- You should set jvmRoute to support load-balancing via AJP ie :
<Engine name="Catalina" defaultHost="localhost" jvmRoute="jvm1">
-->
<Engine defaultHost="localhost" name="Catalina">
以下XML内容略
3、解决:将URL端口号修改为WEB服务的端口号。
即协议protocal 为HTTP/1.1的那一个Connnector的端口号,而不是AJP。
转自:http://blog.youkuaiyun.com/hongweigg/article/details/37811005
本文详细解析了Apache Tomcat中AJP协议访问端口错误的原因,包括错误信息分析、原因解释以及解决方法。通过调整URL端口号,将其修改为实际的WEB服务端口号,可以有效避免此类问题发生。
676

被折叠的 条评论
为什么被折叠?



