纠结的mod_jk与jetty的组合

最近,公司要尝试jetty,我们几个人凑在一块做一下jetty相关的测试. 希望可以用轻量级的jetty替换Jboss , tomact,目前还是小步前进,还是以jetty软件的形式引入,以后Embed Jetty也会是一种方向,真正做到轻量级。


我这边主要测试一下, mod_jk与Jetty链接(以前一直都是用mod_jk 1.2.18)

配置形式: Apache 2.2 + mod_jk 1.2.18 + Jetty 7.1.5

我这里不详细描述具体的安装配置过程,这类教程网上一搜一大把,只记录重点的几个配置和遇到的问题,头痛中。。。


1. Apache 2.2配置

......
Include /home/admin/benni/script/config/mod_jk.conf
......

 

2. mod_jk 1.2.18配置

 

 

LoadModule jk_module /usr/alibaba/httpd/mod_jk.so
JkLogFile "|/usr/alibaba/cronolog/sbin/cronolog /home/admin/output/logs/jk_logs/mod_jk.log.%w"
JkLogLevel error
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"

JkOptions +ForwardURICompatUnparsed
JkOptions +ForwardDirectories

JkMountCopy All
JkShmFile /home/admin/output/jk.shm

.....

JkWorkerProperty worker.list=localnode

JkWorkerProperty worker.localnode.port=7011
JkWorkerProperty worker.localnode.host=localhost
JkWorkerProperty worker.localnode.type=ajp13
JkWorkerProperty worker.localnode.lbfactor=1

JkWorkerProperty worker.localnode.socket_keepalive=True
JkWorkerProperty worker.localnode.socket_timeout=20

JkWorkerProperty worker.localnode.connection_pool_minsize=25
JkWorkerProperty worker.localnode.connection_pool_timeout=600

 

 

3. Jetty 配置

 

 

<Call name="addConnector">
          <Arg>
              <New class="org.eclipse.jetty.ajp.Ajp13SocketConnector">
                   <Set name="port">7011</Set>
                   <!--
                   <Set name="maxIdleTime">600000</Set>
                   <Set name="acceptQueueSize">256</Set>
                   <Set name="statsOn">false</Set>
                   <Set name="confidentialPort">8443</Set>
                   <Set name="lowResourcesMaxIdleTime">5000</Set>
                   <Set name="responseBufferSize">65536</Set>
                   -->
              </New>
          </Arg>
    </Call>
 

 

 

出现的问题:

 

1. Jetty日志:

 

java.io.IOException: FULL
        at org.eclipse.jetty.ajp.Ajp13Parser.fill(Ajp13Parser.java:199)
        at org.eclipse.jetty.ajp.Ajp13Parser.parseNext(Ajp13Parser.java:553)
        at org.eclipse.jetty.ajp.Ajp13Parser.parseAvailable(Ajp13Parser.java:156)
        at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:424)
        at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:241)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
        at java.lang.Thread.run(Thread.java:619)

 2. mod_jk wrong message

[Wed Oct 20 19:49:34 2010][20298:1599269184] [error] ajp_connection_tcp_get_message::jk_ajp_common.c (1212): wrong message size 8195 8192 from 127.0.0.1:7011
[Wed Oct 20 19:49:34 2010][20298:1599269184] [error] ajp_get_reply::jk_ajp_common.c (1992): (localnode) Tomcat is down or network problems. Part of the response has already been sent to the client
[Wed Oct 20 19:49:34 2010][20298:1599269184] [error] ajp_connection_tcp_get_message::jk_ajp_common.c (1212): wrong message size 8195 8192 from 127.0.0.1:7011
[Wed Oct 20 19:49:34 2010][20298:1599269184] [error] ajp_get_reply::jk_ajp_common.c (1992): (localnode) Tomcat is down or network problems. Part of the response has already been sent to the client
[Wed Oct 20 19:49:34 2010][20298:1599269184] [error] ajp_service::jk_ajp_common.c (2466): (localnode) connecting to tomcat failed.
 

  3. mod_jk  can't receive the response body

[Wed Oct 20 19:50:00 2010][21270:1598732608] [error] ajp_connection_tcp_get_message::jk_ajp_common.c (1242): (localnode) can't receive the response body message from tomcat, network problems or tomcat (127.0.0.1:7011) is down (errno=11)
[Wed Oct 20 19:50:00 2010][21270:1598732608] [error] ajp_get_reply::jk_ajp_common.c (1992): (localnode) Tomcat is down or network problems. Part of the response has already been sent to the client
[Wed Oct 20 19:50:00 2010][21270:1598732608] [error] ajp_service::jk_ajp_common.c (2466): (localnode) connecting to tomcat failed

 

最后:

查询了相关资料,发现网上还是有很多人出现了类似的情况,目前一直还未解决问题,先记录着,等以后解决

 

几点建议:

1.  jetty使用jetty 7.1.6, 修复了几个问题,可查看 changeLog 

2.  关注下jdk 1.6中nio的bug ,  JDK1.6+Problems , 可能会出现类似mail list提到的问题,cpu使用100%, 具体查看http://dev.eclipse.org/mhonarc/lists/jetty-users/msg00613.html

 

 

 

相关资料:

你可能感兴趣的:(eclipse,tomcat,C++,c,C#)