开发者社区> 问答> 正文

请教Apache2.2.3整合Jboss4.2.2的问题!:配置报错

看了下官方的配置 网站是 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 Foundation\Apache2.2\conf\mod_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 ,搞了半天不清楚。 请教大神们,解决问题,小弟不胜感激········

   

     

展开
收起
kun坤 2020-06-01 11:11:14 408 0
1 条回答
写回答
取消 提交回答
  • connect to 192.168.1.26:8009 failed apache + tomcat mod_jk 实际上是通过ajp 通信的 tomcat 的ajp 开的端口默认是8009 不知道jboss 是不是这种方式.######你的配置里面好像用的都是localhost,最好在启动命令后面加上参数-b 0.0.0.0 。这样就不会说连到特定的ip呢######其实配置jboss和tomcat差不多,多看看,多配置几次就明白问题出在哪里。######问题已经解决了,实现了JBoss的集群、session复制以及Tomcat的。完美解决,还是自己动手,丰衣足食。######求解,原因出在哪里了……

    2020-06-01 11:11:21
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
Apache Flink技术进阶 立即下载
Apache Spark: Cloud and On-Prem 立即下载
Hybrid Cloud and Apache Spark 立即下载

相关镜像