日期:2014-05-17  浏览次数:21073 次

apache使用proxypass连接tomcat 的一个问题 error(120006)

?

apache使用proxypass连接tomcat 的一个问题,apache的error log片段如下

?

我使用apache管理了多个tomcat,每个tomcat都使用不同的端口,其他网站都可以正常访问,但是今天新增了一个就出现这个问题,非常奇怪

?

[Wed Mar 09 11:19:50 2011] [error] ajp_read_header: ajp_ilink_receive failed
[Wed Mar 09 11:19:50 2011] [error] (120006)APR does not understand this error code: proxy: read response failed from (null) (localhost)
[Wed Mar 09 11:19:53 2011] [error] (70014)End of file found: ajp_ilink_receive() can't receive header
[Wed Mar 09 11:19:53 2011] [error] ajp_read_header: ajp_ilink_receive failed
[Wed Mar 09 11:19:53 2011] [error] (120006)APR does not understand this error code: proxy: read response failed from (null) (localhost)
[Wed Mar 09 11:19:53 2011] [error] (70014)End of file found: ajp_ilink_receive() can't receive header
[Wed Mar 09 11:19:53 2011] [error] ajp_read_header: ajp_ilink_receive failed
[Wed Mar 09 11:19:53 2011] [error] (120006)APR does not understand this error code: proxy: read response failed from (null) (localhost)
[Wed Mar 09 11:19:54 2011] [error] (70014)End of file found: ajp_ilink_receive() can't receive header
[Wed Mar 09 11:19:54 2011] [error] ajp_read_header: ajp_ilink_receive failed
?在网上搜了很多方法,都是不能解决问题,后来经过排查,发现和 ajp的端口有关系,原来使用的是8009,修改为大于8010的端口即可,问题解决了,但是不知道原因,希望对遇到相同问题的朋友们有帮助,或者有人知道原因,请分享一下
1 楼 peyote 2011-11-25  
楼主是怎么通过排查发现和ajp端口有关系的?
2 楼 zxh56964106 2012-04-06  
我也遇到了同样的问题,我是这样解决的:
在apache的配置文件中:
ProxyRequests Off
     <proxy balancer://cluster>
          BalancerMember ajp://192.168.9.103:8009 loadfactor=1 route=jvm1
          BalancerMember ajp://192.168.9.103:9009 loadfactor=1 route=jvm2
     </proxy>
上面的代码是用来告知apache进行负载均衡的,使用了两个tomcat后面的端口就是ajp的连接端口,而这两个端口需要在相应的tomcat下的server.xml进行配置。
具体如下:
例如:tomcat1:
    <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />
tomcat2:
<Connector port="9009" protocol="AJP/1.3" redirectPort="8443" />
我的问题就是这样解决的。