请教Apache2.2.3整合Jboss4.2.2的问题!

发布于 2021-11-17 12:32:15 字数 8565 浏览 808 评论 3

看了下官方的配置 网站是 https://community.jboss.org/wiki/UsingModjk12WithJBoss

软件是用发如题所看到的。链接是用的“mod_jk-1.2.28-httpd-2.2.3.so” 在运行的时候碰到了问题,先说下配置,再来提问。可能是蛮老的东西,希望有所有解答,谢谢。

首先,我说下,我配置Tomcat是成功的,但是JBOSS却不成功,我是根据官网上面的配置一步步走下来的,先来apache2 

里面的httpd.conf文件,里面加了一句:

# Include mod_jk
include "D:Apache Software FoundationApache2.2confmod_jk.conf" 

然后是自己新建的文件,收先是 mod_jk.conf:

LoadModule jk_module modules/mod_jk-1.2.28-httpd-2.2.3.so
# Load mod_jk module

# Where to find workers.properties
JkWorkersFile conf/workers.properties

# Where to put jk logs
JkLogFile logs/mod_jk.log

# Set the jk log level [debug/error/info]
JkLogLevel info

# Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"

# JkOptions indicates to send SSK KEY SIZE
# Notes: 
# 1) Changed from +ForwardURICompat. 
# 2) For mod_rewrite compatibility, use +ForwardURIProxy (default since 1.2.24)
# See http://tomcat.apache.org/security-jk.html  
JkOptions +ForwardKeySize +ForwardURICompatUnparsed -ForwardDirectories

# JkRequestLogFormat
JkRequestLogFormat "%w %V %T"

# Mount your applications
JkMount /test/* loadbalancer
# Let Apache serve the images
# JkUnMount /__application__/images/* loadbalancer

# You can use external file for mount points.
# It will be checked for updates each 60 seconds.
# The format of the file is: /url=worker
# /examples/*=loadbalancer
JkMountFile conf/uriworkermap.properties

# Add shared memory.
# This directive is present with 1.2.10 and
# later versions of mod_jk, and is needed for
# for load balancing to work properly
# Note: Replaced JkShmFile logs/jk.shm due to SELinux issues. Refer to 
# https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=225452
JkShmFile run/jk.shm

# Add jkstatus for managing runtime data
<Location /jkstatus>
JkMount status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>

然后是workers.properties:

# Define list of workers that will be used
# for mapping requests
# The configuration directives are valid
# for the mod_jk version 1.2.18 and later
#
worker.list=loadbalancer,status

# Define Node1
# modify the host as your host IP or DNS name.
worker.node1.port=8009
worker.node1.host=localhost
worker.node1.type=ajp13
worker.node1.lbfactor=1
worker.node1.prepost_timeout=10000 #Not required if using ping_mode=A
worker.node1.connect_timeout=10000 #Not required if using ping_mode=A
#worker.node1.ping_mode=A #As of mod_jk 1.2.27
# worker.node1.connection_pool_size=10 (1)


# Load-balancing behaviour
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=node1

# Status worker for managing load balancer
worker.status.type=status

接着uriworkermap.properties:

# Simple worker configuration file
#

# Mount the Servlet context to the ajp13 worker
/jmx-console=loadbalancer
/jmx-console/*=loadbalancer
/web-console=loadbalancer
/web-console/*=loadbalancer

/test/*=loadbalancer

/test=loadbalancer

上面是所有Apache2的配置了。然后我启动了Apache2,log的显示是:

[Thu Jan 12 14:33:55 2012][5964:2312] [info] mod_jk.c (3183): mod_jk/1.2.28 initialized
[Thu Jan 12 14:33:55 2012][5964:2312] [info] mod_jk.c (3183): mod_jk/1.2.28 initialized
[Thu Jan 12 14:33:55 2012][3988:6148] [info] mod_jk.c (3183): mod_jk/1.2.28 initialized
[Thu Jan 12 14:33:55 2012][3988:6148] [info] mod_jk.c (3183): mod_jk/1.2.28 initialized

那就说明应该是没有问题的。

然后配置的是Jboss4.2.2GA版本的

先是$JBOSS_HOME/server/all/deploy/jboss-web.deployer/server.xml下面:

<Engine name="jboss.web" defaultHost="localhost" jvmRoute="node1">
...
</...>

然后$JBOSS_HOME/server/all/deploy/jboss-web.deployer/META-INF/jboss-service.xml里面的设置一个属性为true:

<attribute name="UseJK">true</attribute>

这样配置完了所有的。Tomcat我也是相关的配置了下Apache2的配置。Tomcat整合成功,而且集群各种什么都是好的。但是Jboss就不行。不知道神马原因。我试着访问了:

http://localhost/test/index.jsp
http://localhost/web-console

结果都是报错:

Service Temporarily Unavailable
The server is temporarily unable to service your request due to 
maintenance downtime or capacity problems. Please try again later.

不知道是个神马情况,然后我看了下Apache2的log文件上面写的是这样的:

[Thu Jan 12 14:31:51 2012][5160:3920] [info] mod_jk.c (3183): mod_jk/1.2.28 initialized
[Thu Jan 12 14:31:51 2012][5160:3920] [info] mod_jk.c (3183): mod_jk/1.2.28 initialized
[Thu Jan 12 14:31:51 2012][2488:5460] [info] mod_jk.c (3183): mod_jk/1.2.28 initialized
[Thu Jan 12 14:31:51 2012][2488:5460] [info] mod_jk.c (3183): mod_jk/1.2.28 initialized
[Thu Jan 12 14:32:07 2012][2488:6268] [info] jk_connect.c (594): connect to 192.168.1.26:8009 failed (errno=61)
[Thu Jan 12 14:32:07 2012][2488:6268] [info] jk_ajp_common.c (922): Failed opening socket to (192.168.1.26:8009) (errno=61)
[Thu Jan 12 14:32:07 2012][2488:6268] [error] jk_ajp_common.c (1507): (node1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=61)
[Thu Jan 12 14:32:07 2012][2488:6268] [info] jk_ajp_common.c (2447): (node1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
[Thu Jan 12 14:32:08 2012][2488:6268] [info] jk_connect.c (594): connect to 192.168.1.26:8009 failed (errno=61)
[Thu Jan 12 14:32:08 2012][2488:6268] [info] jk_ajp_common.c (922): Failed opening socket to (192.168.1.26:8009) (errno=61)
[Thu Jan 12 14:32:08 2012][2488:6268] [error] jk_ajp_common.c (1507): (node1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=61)
[Thu Jan 12 14:32:08 2012][2488:6268] [info] jk_ajp_common.c (2447): (node1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
[Thu Jan 12 14:32:08 2012][2488:6268] [error] jk_ajp_common.c (2466): (node1) connecting to tomcat failed.
[Thu Jan 12 14:32:08 2012][2488:6268] [info] jk_lb_worker.c (1384): service failed, worker node1 is in error state
[Thu Jan 12 14:32:08 2012][2488:6268] [info] jk_lb_worker.c (1436): Forcing recovery once for 1 workers
[Thu Jan 12 14:32:09 2012][2488:6268] [info] jk_connect.c (594): connect to 192.168.1.26:8009 failed (errno=61)
[Thu Jan 12 14:32:09 2012][2488:6268] [info] jk_ajp_common.c (922): Failed opening socket to (192.168.1.26:8009) (errno=61)
[Thu Jan 12 14:32:09 2012][2488:6268] [error] jk_ajp_common.c (1507): (node1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=61)
[Thu Jan 12 14:32:09 2012][2488:6268] [info] jk_ajp_common.c (2447): (node1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
[Thu Jan 12 14:32:10 2012][2488:6268] [info] jk_connect.c (594): connect to 192.168.1.26:8009 failed (errno=61)
[Thu Jan 12 14:32:10 2012][2488:6268] [info] jk_ajp_common.c (922): Failed opening socket to (192.168.1.26:8009) (errno=61)
[Thu Jan 12 14:32:10 2012][2488:6268] [error] jk_ajp_common.c (1507): (node1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=61)
[Thu Jan 12 14:32:10 2012][2488:6268] [info] jk_ajp_common.c (2447): (node1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
[Thu Jan 12 14:32:10 2012][2488:6268] [error] jk_ajp_common.c (2466): (node1) connecting to tomcat failed.
[Thu Jan 12 14:32:10 2012][2488:6268] [info] jk_lb_worker.c (1384): service failed, worker node1 is in error state
[Thu Jan 12 14:32:10 2012][2488:6268] [info] jk_lb_worker.c (1464): All tomcat instances are busy or in error state
[Thu Jan 12 14:32:10 2012][2488:6268] [error] jk_lb_worker.c (1469): All tomcat instances failed, no more workers left
[Thu Jan 12 14:32:10 2012]loadbalancer localhost 4.318000
[Thu Jan 12 14:32:10 2012][2488:6268] [info] mod_jk.c (2615): Service error=0 for worker=loadbalancer

我不明白为什么是connect to 192.168.1.26:8009 failed ,搞了半天不清楚。

请教大神们,解决问题,小弟不胜感激········

 

 

 

 

 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

晚风撩人 2021-11-18 11:14:03

求解,原因出在哪里了……

北笙凉宸 2021-11-18 10:57:14

你的配置里面好像用的都是localhost,最好在启动命令后面加上参数-b 0.0.0.0 。这样就不会说连到特定的ip呢

离不开的别离 2021-11-18 07:41:41

connect to 192.168.1.26:8009 failed

apache + tomcat mod_jk 实际上是通过ajp 通信的

tomcat 的ajp 开的端口默认是8009

不知道jboss 是不是这种方式.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文