最近,公司要尝试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
我这里不详细描述具体的安装配置过程,这类教程网上一搜一大把,只记录重点的几个配置和遇到的问题,头痛中。。。
3. Jetty 配置
出现的问题:
2. mod_jk wrong message
我这边主要测试一下, mod_jk与Jetty链接(以前一直都是用mod_jk 1.2.18)
配置形式: Apache 2.2 + mod_jk 1.2.18 + Jetty 7.1.5
我这里不详细描述具体的安装配置过程,这类教程网上一搜一大把,只记录重点的几个配置和遇到的问题,头痛中。。。
1. Apache 2.2配置
1.......
2.Include /home/admin/benni/script/config/mod_jk.conf
3.......
2. mod_jk 1.2.18配置
1.LoadModule jk_module /usr/alibaba/httpd/mod_jk.so
2.JkLogFile "|/usr/alibaba/cronolog/sbin/cronolog /home/admin/output/logs/jk_logs/mod_jk.log.%w"
3.JkLogLevel error
4.JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
5.
6.JkOptions +ForwardURICompatUnparsed
7.JkOptions +ForwardDirectories
8.
9.JkMountCopy All
10.JkShmFile /home/admin/output/jk.shm
11.
12......
13.
14.JkWorkerProperty worker.list=localnode
15.
16.JkWorkerProperty worker.localnode.port=7011
17.JkWorkerProperty worker.localnode.host=localhost
18.JkWorkerProperty worker.localnode.type=ajp13
19.JkWorkerProperty worker.localnode.lbfactor=1
20.
21.JkWorkerProperty worker.localnode.socket_keepalive=True
22.JkWorkerProperty worker.localnode.socket_timeout=20
23.
24.JkWorkerProperty worker.localnode.connection_pool_minsize=25
25.JkWorkerProperty worker.localnode.connection_pool_timeout=600
3. Jetty 配置
1.<Call name="addConnector">
2. <Arg>
3. <New class="org.eclipse.jetty.ajp.Ajp13SocketConnector">
4. <Set name="port">7011</Set>
5. <!--
6. <Set name="maxIdleTime">600000</Set>
7. <Set name="acceptQueueSize">256</Set>
8. <Set name="statsOn">false</Set>
9. <Set name="confidentialPort">8443</Set>
10. <Set name="lowResourcesMaxIdleTime">5000</Set>
11. <Set name="responseBufferSize">65536</Set>
12. -->
13. </New>
14. </Arg>
15. </Call>
16.
出现的问题:
1.java.io.IOException: FULL
2. at org.eclipse.jetty.ajp.Ajp13Parser.fill(Ajp13Parser.java:199)
3. at org.eclipse.jetty.ajp.Ajp13Parser.parseNext(Ajp13Parser.java:553)
4. at org.eclipse.jetty.ajp.Ajp13Parser.parseAvailable(Ajp13Parser.java:156)
5. at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:424)
6. at org.eclipse.jetty.server.bio.SocketConnector$ConnectorEndPoint.run(SocketConnector.java:241)
7. at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
8. at java.lang.Thread.run(Thread.java:619)
2. mod_jk wrong message
1.[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
2.[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
3.[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
4.[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
5.[Wed Oct 20 19:49:34 2010][20298:1599269184] [error] ajp_service::jk_ajp_common.c (2466): (localnode) connecting to tomcat failed.
1.[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)
2.[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
3.[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
相关资料:
- 网上类似问题 : http://comments.gmane.org/gmane.comp.java.jetty.support/10660
- jetty codehaus的jira库: http://jira.codehaus.org/browse/JETTY
- jetty mail list : http://dev.eclipse.org/mhonarc/lists/jetty-users/threads.html http://archive.codehaus.org/lists/org.codehaus.jetty.user/
- tomcat mail list : http://mail-archives.apache.org/mod_mbox/tomcat-users/