还是Apache+Mod_jk+Tomcat的问题

武夷 发布于 2012/02/29 18:13
阅读 5K+
收藏 0

    我现在的Tomcat和jboss部署在电信机房,由于网络的问题,网通用户几乎无法访问,然后我找了一个多线机房安装Apache2.2代理,网络速度也还可以,但碰到一个比较头大的问题,就是经常发生第一次访问系统时会出现延迟的现象,访问成功后如果一直浏览就不会有这种现象了,查了很多资料说是AJP的Timeout的问题,但是都没有解决。后来换mod_proxy_ajp也是一样,Apache中出错的日志信息如下:

[error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (jboss8109_mc1) cping/cpong after connecting to the backend server failed (errno=60)
[error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (jboss8109_mc1) cping/cpong after connecting to the backend server failed (errno=60)
[error] ajp_send_request::jk_ajp_common.c (1630): (jboss8109_mc1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[error] ajp_send_request::jk_ajp_common.c (1630): (jboss8109_mc1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (jboss8109_mc1) cping/cpong after connecting to the backend server failed (errno=60)
[error] ajp_send_request::jk_ajp_common.c (1630): (jboss8109_mc1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (jboss8109_mc1) cping/cpong after connecting to the backend server failed (errno=60)
[error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (jboss8109_mc1) cping/cpong after connecting to the backend server failed (errno=60)
[error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (jboss8109_mc1) cping/cpong after connecting to the backend server failed (errno=60)
[error] ajp_send_request::jk_ajp_common.c (1630): (jboss8109_mc1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (jboss8109_mc1) cping/cpong after connecting to the backend server failed (errno=60)
[error] ajp_send_request::jk_ajp_common.c (1630): (jboss8109_mc1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (jboss8109_mc1) cping/cpong after connecting to the backend server failed (errno=60)
[error] ajp_send_request::jk_ajp_common.c (1630): (jboss8109_mc1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (jboss8109_mc1) cping/cpong after connecting to the backend server failed (errno=60)
[error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (jboss8109_mc1) cping/cpong after connecting to the backend server failed (errno=60)
[error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (jboss8109_mc1) cping/cpong after connecting to the backend server failed (errno=60)
[error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (jboss8109_mc1) cping/cpong after connecting to the backend server failed (errno=60)
[error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (jboss8109_mc1) cping/cpong after connecting to the backend server failed (errno=60)
[error] ajp_send_request::jk_ajp_common.c (1630): (jboss8109_mc1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (jboss8109_mc1) cping/cpong after connecting to the backend server failed (errno=60)
[error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (jboss8109_mc1) cping/cpong after connecting to the backend server failed (errno=60)
[error] ajp_send_request::jk_ajp_common.c (1630): (jboss8109_mc1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (jboss8109_mc1) cping/cpong after connecting to the backend server failed (errno=60)
[error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (jboss8109_mc1) cping/cpong after connecting to the backend server failed (errno=60)
[error] ajp_send_request::jk_ajp_common.c (1630): (jboss8109_mc1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[error] ajp_send_request::jk_ajp_common.c (1630): (jboss8109_mc1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[error] ajp_send_request::jk_ajp_common.c (1630): (jboss8109_mc1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[error] ajp_send_request::jk_ajp_common.c (1630): (jboss8109_mc1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[error] ajp_send_request::jk_ajp_common.c (1630): (jboss8109_mc1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[error] ajp_send_request::jk_ajp_common.c (1630): (jboss8109_mc1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[error] ajp_send_request::jk_ajp_common.c (1630): (jboss8109_mc1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[error] ajp_send_request::jk_ajp_common.c (1630): (jboss8109_mc1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[error] ajp_send_request::jk_ajp_common.c (1630): (jboss8109_mc1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (jboss8109_mc1) cping/cpong after connecting to the backend server failed (errno=60)
[error] ajp_send_request::jk_ajp_common.c (1630): (jboss8109_mc1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[error] ajp_send_request::jk_ajp_common.c (1630): (jboss8109_mc1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)
[error] ajp_connect_to_endpoint::jk_ajp_common.c (1035): (jboss8109_mc1) cping/cpong after connecting to the backend server failed (errno=60)
[error] ajp_send_request::jk_ajp_common.c (1630): (jboss8109_mc1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=60)

Apache中相关的配置:

<IfModule !mod_jk.c>
    LoadModule jk_module conf/jk/mod_jk.so
</IfModule>

JkWorkerProperty worker.list=mccontroller,status

JkWorkerProperty worker.mccontroller.type=lb
JkWorkerProperty worker.mccontroller.balance_workers=jboss8109_mc1,jboss8109_mc2

# To select the best worker: B[usyness]-not busy, R[equest]-default
JkWorkerProperty worker.mccontroller.method=B

# sticky_session  sticky_session_force        desc
# true            false                       SESSION会复制,有粘性
# true            true                        SESSION不复制,有粘性
# false           false                       SESSION会复制,有粘性
# false           true                        SESSION不复制,有粘性
# true - 请求始终由当前的tomcat处理
JkWorkerProperty worker.mccontroller.sticky_session=true
# false - 当前tomcat挂了时,将session复制到另一台继续
JkWorkerProperty worker.mccontroller.sticky_session_force=false

JkWorkerProperty worker.status.type=status

## ============= jboss8109_mc1 =============== ##
JkWorkerProperty worker.jboss8109_mc1.port=8109
JkWorkerProperty worker.jboss8109_mc1.host=117.25.149.1
JkWorkerProperty worker.jboss8109_mc1.type=ajp13
JkWorkerProperty worker.jboss8109_mc1.lbfactor=1
JkWorkerProperty worker.jboss8109_mc1.socket_keepalive=True
JkWorkerProperty worker.jboss8109_mc1.socket_timeout=0
JkWorkerProperty worker.jboss8109_mc1.ping_mode=A
JkWorkerProperty worker.jboss8109_mc1.connect_timeout=600
JkWorkerProperty worker.jboss8109_mc1.connection_pool_timeout=600
JkWorkerProperty worker.jboss8109_mc1.retries=3
JkWorkerProperty worker.jboss8109_mc1.recovery_options=3

## ============= jboss8109_mc2 =============== ##
JkWorkerProperty worker.jboss8109_mc2.port=8109
JkWorkerProperty worker.jboss8109_mc2.host=117.25.149.2
JkWorkerProperty worker.jboss8109_mc2.type=ajp13
JkWorkerProperty worker.jboss8109_mc2.lbfactor=1
JkWorkerProperty worker.jboss8109_mc2.socket_keepalive=True
JkWorkerProperty worker.jboss8109_mc2.socket_timeout=0
JkWorkerProperty worker.jboss8109_mc2.ping_mode=A
JkWorkerProperty worker.jboss8109_mc2.connect_timeout=600
JkWorkerProperty worker.jboss8109_mc2.connection_pool_timeout=600
JkWorkerProperty worker.jboss8109_mc2.retries=3
JkWorkerProperty worker.jboss8109_mc2.recovery_options=3

JkLogFile "logs/mc_mod_jk.log"
JkLogLevel warn
##JkLogLevel emerg
##JkLogLevel debug
HostnameLookups Off

<VirtualHost www.test.com:80>
 ServerName www.test.com

 Header set P3P 'CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"'

 JkMount /jkstatus status
 JkMount /* mccontroller
</VirtualHost>

<VirtualHost *:80>
 ServerName app.test.com

 Header set P3P 'CP="CURa ADMa DEVa PSAo PSDo OUR BUS UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"'

 JkMount /* mccontroller
</VirtualHost>

JBOSS中Server.xml中connector中AJP配置如下:

  <Connector port="8109" address="${jboss.bind.address}" redirectPort="8443" protocol="AJP/1.3"
   maxHttpHeaderSize="8192" strategy="ms" emptySessionPath="true"
   maxThreads="1000" minSpareThreads="100" maxSpareThreads="500"
   enableLookups="false" acceptCount="100"  URIEncoding="GBK"
   disableUploadTimeout="true"
   compression="on" compressionMinSize="2048" noCompressionUserAgents="gozilla, traviata"
   compressableMimeType="text/html,text/xml,text/javascript, text/css, text/plain,application/xhtml+xml,application/x-javascript,application/javascript,text/xhtml"
  />
看了一些资料,加入connectionTimeout=600000也是不行。

不知道有没有人碰到过同样的问题,调试了好几天了,求解。谢谢

加载中
0
红薯
红薯

问题是连接不上 8109 端口,connectionTimeout 设置再大也没用的

${jboss.bind.address} 是什么东西啊? 值是什么,不会是 127.0.0.1 吧?

0
武夷
武夷

谢谢红薯,如果是连接不上8109端口的话就会报错,但是大多数时候是第一次访问时延迟一段时间后页面正常打开,随后的访问没有问题的。

另外${jboss.bind.address}在我用的Jboss4.0.3版本下是0.0.0.0,这个是没有问题的

0
g
guilin小唐

我的问题也是这样啊,通过tomcat端口可以访问网站,但是用到整合就不行了,不知道是哪出问题了,mod_jk.logs报如下错误了:(监听的是8019端口)好心人,能帮忙讲解一下吗?

[Mon Apr 02 23:30:33 2012] ajp13 222.218.130.42 2.125000
[Mon Apr 02 23:30:33 2012] [8188:8376] [info] mod_jk.c (2364): Service error=-3 for worker=ajp13
[Mon Apr 02 23:32:29 2012] [8188:10160] [info] jk_connect.c (566): connect to 127.0.0.1:8019 failed (errno=61)
[Mon Apr 02 23:32:29 2012] [8188:10160] [info] jk_ajp_common.c (869): Failed opening socket to (127.0.0.1:8019) (errno=61)
[Mon Apr 02 23:32:29 2012] [8188:10160] [error] jk_ajp_common.c (1359): (ajp13) connecting to backend failed. Tomcat is probably not started

or is listening on the wrong port (errno=61)
[Mon Apr 02 23:32:29 2012] [8188:10160] [info] jk_ajp_common.c (2186): (ajp13) sending request to tomcat failed (recoverable), because of

error during request sending (attempt=1)
[Mon Apr 02 23:32:30 2012] [8188:10160] [info] jk_connect.c (566): connect to 127.0.0.1:8019 failed (errno=61)
[Mon Apr 02 23:32:30 2012] [8188:10160] [info] jk_ajp_common.c (869): Failed opening socket to (127.0.0.1:8019) (errno=61)
[Mon Apr 02 23:32:30 2012] [8188:10160] [error] jk_ajp_common.c (1359): (ajp13) connecting to backend failed. Tomcat is probably not started

or is listening on the wrong port (errno=61)
[Mon Apr 02 23:32:30 2012] [8188:10160] [info] jk_ajp_common.c (2186): (ajp13) sending request to tomcat failed (recoverable), because of

error during request sending (attempt=2)
[Mon Apr 02 23:32:30 2012] [8188:10160] [error] jk_ajp_common.c (2204): (ajp13) Connecting to tomcat failed. Tomcat is probably not started

or is listening on the wrong port

0
g
guilin小唐
根据提示好像是tomcat没有启动或者是监听错了端口,但是这两个地方我都注意了,没有问题的。
mj4738
mj4738
我也遇到这个问题,我测试过网络是没有问题的,
0
g
guilin小唐

<Connector port="8443" maxThreads="150" scheme="https" secure="true" SSLEnabled="true" enableLookups="false"
         keystoreFile="D:\WebServer\Tomcat6\.keystore" keystorePass="lct586970"
               clientAuth="false" sslProtocol="TLS" />
    <!--
    <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="8019" protocol="AJP/1.3" redirectPort="8443" />

0
mj4738
mj4738
@武夷 @红薯 我也遇到这个问题
0
武夷
武夷
@爱国者 我后面采用proxy处理这个,现在运行基本正常
mj4738
mj4738
proxy效率不搞啊
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部