BAD packet signature 18245 错误解决

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请求訪问port不对。也就是说在浏览器中输入的URLport号是AJP协议的port号,而不是WEB服务的port号。

以下的样例中ARJ协议port号为8009,真正的WEB服务port号应为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、解决:将URLport号改动为WEB服务的port号。

即协议protocal 为HTTP/1.1的那一个Connnector的port号,而不是AJP。


原文地址:https://www.cnblogs.com/mfrbuaa/p/3922674.html