轻逐微风 发表于 2010-05-24 23:08

渴望高手赐教!tomcat+apache+mod_jk连接,出现500错误解决方法!

本帖最后由 轻逐微风 于 2010-05-24 23:10 编辑

软件版本:apache-tomcat-5.5.29          httpd-2.2.15          tomcat-connectors-1.2.28(apache2.0的mod_jk.so)          apache的配置文件httpd.conf中用语句include包含了jk.conf文件tomcat的配置文件基本没改,唯一改的地方是在<Engine name="Catalina" defaultHost="localhost" />中添加了jvmRoute="tomcat1"jk.conf文件内容为LoadModule jk_module modules/mod_jk.so
JkWorkersFile /usr/local/httpd/conf/workers.properties
JkMountFile /usr/local/httpd/conf/uriworkermap.properties
JkLogFile /usr/local/httpd/logs/mod_jk.log
JKmount /servlet/* ajp13
Jkmount /*.jsp ajp13
JkLogLevel info
workers.properties文件内容为worker.list=tomcat1
worker.tomcat1.port=8009
worker.tomcat1.host=localhost
worker.tomcat1.type=ajp13
worker.tomcat1.lbfactor=1

uriworkermap.properties文件中的内容为/*=tomcat1
!/*jpg=tomcat1
!/*gif=tomcat1
!/*png=tomcat1
!/*bmp=tomcat1
!/*html=tomcat1
!/*swf=tomcat1
!/*css=tomcat1
!/*js=tomcat1
!/*jsp=tomcat1
屏蔽掉uriworkermap.properties文件中的如下语句后。在浏览器中能看到apache首页的图片文件,也可以看到其它html页面。!/*jpg=tomcat1
!/*gif=tomcat1
!/*png=tomcat1
!/*bmp=tomcat1
!/*html=tomcat1
!/*swf=tomcat1
!/*css=tomcat1
!/*js=tomcat1
!/*jsp=tomcat1否则会出现如下图的错误——无法看到tomcat的log图片,并且访问http://11.92.0.237/manager/html等相似页面会出现404错误
apache的错误日志截图如下:渴望找个像朋友一样的师傅,平时可能遇到配置问题,百度,google后向您讨教。我现在是学生,工作后定当重谢,你的恩情将永不相忘!我们学校教的linux比较浅(连编译安装以及shell都没教过),自学起来比较困难,学习速度较缓慢,其主要原因是遇到一个很简单的问题,由于没有经验导致浪费时间诸多。自己又比较喜欢Linux并且准备在以后从事相关工作,个人有c基础。我的qq122363326

轻逐微风 发表于 2010-05-24 23:35

本帖最后由 轻逐微风 于 2010-05-24 23:36 编辑

刚才把uriworkermap.properties文件中的屏蔽选项都去掉了
改为如下:

/*=tomcat1

/*jpg=tomcat1
/*gif=tomcat1
/*png=tomcat1
/*bmp=tomcat1
/*html=tomcat1
/*swf=tomcat1
/*css=tomcat1
/*js=tomcat1
/*jsp=tomcat1

这个时候访问http://11.92.0.237/test/可以访问了



/usr/local/tomcat/webapps/test下有index.jsp文件

但是用http://11.92.0.237/test/index.jsp还是不能访问
出现以前的500错误,如果是这样的话,我以后的非index.jsp文件不是永远无法访问???:dizzy:

blueswxs 发表于 2010-05-25 09:02

JKmount /servlet/* ajp13

Jkmount /*.jsp ajp13

再加一句

Jkmount /test/* ajp13

轻逐微风 发表于 2010-05-25 13:28

回复 3# blueswxs


    非常感谢!不过我照你说的测试了一下,访问http://11.92.0.237/test/以及http://11.92.0.237/test/index.jsp匀出现500错误了!首页面还是能正常访问。

轻逐微风 发表于 2010-05-25 13:37

本帖最后由 轻逐微风 于 2010-05-25 13:50 编辑

经过 blueswxs (孤独蓝)的提醒,才发现出来。
问题出现在把处理的东西交给了ajp13。

根据我上面的配置,不知道这样理解是否正确,望大家再指明一下,以解后学者之忧。

解决办法将如下语句JKmount /servlet/* ajp13
Jkmount /*.jsp ajp13
Jkmount /test/* ajp13改为JKmount /servlet/*tomcat1
Jkmount /*.jsp tomcat1
Jkmount /test/* tomcat1

blueswxs 发表于 2010-05-25 15:21

/usr/local/httpd/logs/mod_jk.log

日志,贴贴,看看有什么问题。

轻逐微风 发表于 2010-05-25 22:36

本帖最后由 轻逐微风 于 2010-05-25 22:43 编辑

回复 6# blueswxs


下面是单tomcat1(非集群)照上面的配置做出来的所有日志 mod_jk.log文件
结果晚上的时候,在房做了集群,发现严重问题,就是:用了tomcat1不用ajp13还集什么群啊???!!!

init_jk::mod_jk.c (3183): mod_jk/1.2.28 initialized
uri_worker_map_ext::jk_uri_worker_map.c (506): Could not find worker with name 'ajp13' in uri map post processing.
uri_worker_map_ext::jk_uri_worker_map.c (506): Could not find worker with name 'ajp13' in uri map post processing.
init_jk::mod_jk.c (3183): mod_jk/1.2.28 initialized
uri_worker_map_ext::jk_uri_worker_map.c (506): Could not find worker with name 'ajp13' in uri map post processing.
uri_worker_map_ext::jk_uri_worker_map.c (506): Could not find worker with name 'ajp13' in uri map post processing.
jk_open_socket::jk_connect.c (594): connect to 11.92.0.237:8180 failed (errno=111)
ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (11.92.0.237:8180) (errno=111)
ajp_send_request::jk_ajp_common.c (1507): (tomcat1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
ajp_service::jk_ajp_common.c (2447): (tomcat1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
jk_open_socket::jk_connect.c (594): connect to 11.92.0.237:8180 failed (errno=111)
ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (11.92.0.237:8180) (errno=111)
ajp_send_request::jk_ajp_common.c (1507): (tomcat1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
ajp_service::jk_ajp_common.c (2447): (tomcat1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
ajp_service::jk_ajp_common.c (2466): (tomcat1) connecting to tomcat failed.
jk_handler::mod_jk.c (2615): Service error=-3 for worker=tomcat1
jk_open_socket::jk_connect.c (594): connect to 11.92.0.237:8180 failed (errno=111)
ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (11.92.0.237:8180) (errno=111)
ajp_send_request::jk_ajp_common.c (1507): (tomcat1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
ajp_service::jk_ajp_common.c (2447): (tomcat1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
jk_open_socket::jk_connect.c (594): connect to 11.92.0.237:8180 failed (errno=111)
ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (11.92.0.237:8180) (errno=111)
ajp_send_request::jk_ajp_common.c (1507): (tomcat1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
ajp_service::jk_ajp_common.c (2447): (tomcat1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
ajp_service::jk_ajp_common.c (2466): (tomcat1) connecting to tomcat failed.
jk_handler::mod_jk.c (2615): Service error=-3 for worker=tomcat1
jk_open_socket::jk_connect.c (594): connect to 11.92.0.237:8180 failed (errno=111)
ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (11.92.0.237:8180) (errno=111)
ajp_send_request::jk_ajp_common.c (1507): (tomcat1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
ajp_service::jk_ajp_common.c (2447): (tomcat1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
jk_open_socket::jk_connect.c (594): connect to 11.92.0.237:8180 failed (errno=111)
ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (11.92.0.237:8180) (errno=111)
ajp_send_request::jk_ajp_common.c (1507): (tomcat1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
ajp_service::jk_ajp_common.c (2447): (tomcat1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
ajp_service::jk_ajp_common.c (2466): (tomcat1) connecting to tomcat failed.
jk_handler::mod_jk.c (2615): Service error=-3 for worker=tomcat1
jk_handler::mod_jk.c (2623): Could not find a worker for worker name=ajp13
jk_open_socket::jk_connect.c (594): connect to 11.92.0.237:8180 failed (errno=111)
ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (11.92.0.237:8180) (errno=111)
ajp_send_request::jk_ajp_common.c (1507): (tomcat1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
ajp_service::jk_ajp_common.c (2447): (tomcat1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
jk_open_socket::jk_connect.c (594): connect to 11.92.0.237:8180 failed (errno=111)
ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (11.92.0.237:8180) (errno=111)
ajp_send_request::jk_ajp_common.c (1507): (tomcat1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
ajp_service::jk_ajp_common.c (2447): (tomcat1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
ajp_service::jk_ajp_common.c (2466): (tomcat1) connecting to tomcat failed.
jk_handler::mod_jk.c (2615): Service error=-3 for worker=tomcat1
jk_open_socket::jk_connect.c (594): connect to 11.92.0.237:8180 failed (errno=111)
ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (11.92.0.237:8180) (errno=111)
ajp_send_request::jk_ajp_common.c (1507): (tomcat1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
ajp_service::jk_ajp_common.c (2447): (tomcat1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
jk_open_socket::jk_connect.c (594): connect to 11.92.0.237:8180 failed (errno=111)
ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (11.92.0.237:8180) (errno=111)
ajp_send_request::jk_ajp_common.c (1507): (tomcat1) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
ajp_service::jk_ajp_common.c (2447): (tomcat1) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
ajp_service::jk_ajp_common.c (2466): (tomcat1) connecting to tomcat failed.
jk_handler::mod_jk.c (2615): Service error=-3 for worker=tomcat1
init_jk::mod_jk.c (3183): mod_jk/1.2.28 initialized
uri_worker_map_ext::jk_uri_worker_map.c (506): Could not find worker with name 'ajp13' in uri map post processing.
uri_worker_map_ext::jk_uri_worker_map.c (506): Could not find worker with name 'ajp13' in uri map post processing.
jk_handler::mod_jk.c (2623): Could not find a worker for worker name=ajp13
jk_handler::mod_jk.c (2623): Could not find a worker for worker name=ajp13
jk_handler::mod_jk.c (2623): Could not find a worker for worker name=ajp13
init_jk::mod_jk.c (3183): mod_jk/1.2.28 initialized
uri_worker_map_ext::jk_uri_worker_map.c (506): Could not find worker with name 'ajp13' in uri map post processing.
uri_worker_map_ext::jk_uri_worker_map.c (506): Could not find worker with name 'ajp13' in uri map post processing.
jk_handler::mod_jk.c (2623): Could not find a worker for worker name=ajp13
jk_handler::mod_jk.c (2623): Could not find a worker for worker name=ajp13
jk_handler::mod_jk.c (2623): Could not find a worker for worker name=ajp13
ajp_send_request::jk_ajp_common.c (1496): (tomcat1) all endpoints are disconnected, detected by connect check (1), cping (0), send (0)
ajp_send_request::jk_ajp_common.c (1496): (tomcat1) all endpoints are disconnected, detected by connect check (1), cping (0), send (0)
ajp_send_request::jk_ajp_common.c (1496): (tomcat1) all endpoints are disconnected, detected by connect check (1), cping (0), send (0)
jk_handler::mod_jk.c (2623): Could not find a worker for worker name=ajp13
init_jk::mod_jk.c (3183): mod_jk/1.2.28 initialized
uri_worker_map_ext::jk_uri_worker_map.c (506): Could not find worker with name 'ajp13' in uri map post processing.
uri_worker_map_ext::jk_uri_worker_map.c (506): Could not find worker with name 'ajp13' in uri map post processing.
jk_handler::mod_jk.c (2623): Could not find a worker for worker name=ajp13
jk_handler::mod_jk.c (2623): Could not find a worker for worker name=ajp13
init_jk::mod_jk.c (3183): mod_jk/1.2.28 initialized
uri_worker_map_ext::jk_uri_worker_map.c (506): Could not find worker with name 'ajp13' in uri map post processing.
uri_worker_map_ext::jk_uri_worker_map.c (506): Could not find worker with name 'ajp13' in uri map post processing.
jk_handler::mod_jk.c (2623): Could not find a worker for worker name=ajp13
jk_handler::mod_jk.c (2623): Could not find a worker for worker name=ajp13
map_uri_to_worker_ext::jk_uri_worker_map.c (962): Uri * is invalid. Uri must start with /
map_uri_to_worker_ext::jk_uri_worker_map.c (962): Uri * is invalid. Uri must start with /
jk_handler::mod_jk.c (2623): Could not find a worker for worker name=ajp13
jk_handler::mod_jk.c (2623): Could not find a worker for worker name=ajp13
init_jk::mod_jk.c (3183): mod_jk/1.2.28 initialized
init_jk::mod_jk.c (3183): mod_jk/1.2.28 initialized
uri_worker_map_ext::jk_uri_worker_map.c (506): Could not find worker with name 'ajp13' in uri map post processing.
uri_worker_map_ext::jk_uri_worker_map.c (506): Could not find worker with name 'ajp13' in uri map post processing.
init_jk::mod_jk.c (3183): mod_jk/1.2.28 initialized

blueswxs 发表于 2010-05-25 22:49

uri_worker_map_ext::jk_uri_worker_map.c (506): Could not find worker with name 'ajp13' in uri map post processing.
uri_worker_map_ext::jk_uri_worker_map.c (506): Could not find worker with name 'ajp13' in uri map post processing.

aip13 你没定义?
千万别说你一楼贴出来的
jk.conf
workers.properties
是全部内容。。。。。。。。。:em14::em14:

轻逐微风 发表于 2010-05-25 23:11

回复 8# blueswxs


    一楼贴出来的绝对是全部内容。。但是结果却出现这样的情况。。

轻逐微风 发表于 2010-05-25 23:59

继续弄session集群,错误日志如下:
jk_open_socket::jk_connect.c (594): connect to 11.92.0.249:9009 failed (errno=111)
ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (11.92.0.249:9009) (errno=111)
ajp_send_request::jk_ajp_common.c (1507): (tomcat2) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
ajp_service::jk_ajp_common.c (2447): (tomcat2) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
jk_open_socket::jk_connect.c (594): connect to 11.92.0.249:9009 failed (errno=111)
ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (11.92.0.249:9009) (errno=111)
ajp_send_request::jk_ajp_common.c (1507): (tomcat2) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
ajp_service::jk_ajp_common.c (2447): (tomcat2) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
jk_open_socket::jk_connect.c (594): connect to 11.92.0.249:9009 failed (errno=111)
ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (11.92.0.249:9009) (errno=111)
ajp_send_request::jk_ajp_common.c (1507): (tomcat2) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
ajp_service::jk_ajp_common.c (2447): (tomcat2) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
ajp_service::jk_ajp_common.c (2466): (tomcat2) connecting to tomcat failed.
service::jk_lb_worker.c (1384): service failed, worker tomcat2 is in local error state
jk_open_socket::jk_connect.c (594): connect to 11.92.0.249:9009 failed (errno=111)
ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (11.92.0.249:9009) (errno=111)
ajp_send_request::jk_ajp_common.c (1507): (tomcat2) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
ajp_service::jk_ajp_common.c (2447): (tomcat2) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
ajp_service::jk_ajp_common.c (2466): (tomcat2) connecting to tomcat failed.
service::jk_lb_worker.c (1384): service failed, worker tomcat2 is in error state
jk_handler::mod_jk.c (2623): Could not find a worker for worker name=ajp13
jk_handler::mod_jk.c (2623): Could not find a worker for worker name=ajp13
jk_handler::mod_jk.c (2623): Could not find a worker for worker name=ajp13
jk_handler::mod_jk.c (2623): Could not find a worker for worker name=ajp13
jk_handler::mod_jk.c (2623): Could not find a worker for worker name=ajp13
jk_handler::mod_jk.c (2623): Could not find a worker for worker name=ajp13
jk_handler::mod_jk.c (2623): Could not find a worker for worker name=ajp13
jk_open_socket::jk_connect.c (594): connect to 11.92.0.249:9009 failed (errno=111)
ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (11.92.0.249:9009) (errno=111)
ajp_send_request::jk_ajp_common.c (1507): (tomcat2) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
ajp_service::jk_ajp_common.c (2447): (tomcat2) sending request to tomcat failed (recoverable), because of error during request sending (attempt=1)
jk_open_socket::jk_connect.c (594): connect to 11.92.0.249:9009 failed (errno=111)
ajp_connect_to_endpoint::jk_ajp_common.c (922): Failed opening socket to (11.92.0.249:9009) (errno=111)
ajp_send_request::jk_ajp_common.c (1507): (tomcat2) connecting to backend failed. Tomcat is probably not started or is listening on the wrong port (errno=111)
ajp_service::jk_ajp_common.c (2447): (tomcat2) sending request to tomcat failed (recoverable), because of error during request sending (attempt=2)
ajp_service::jk_ajp_common.c (2466): (tomcat2) connecting to tomcat failed.
service::jk_lb_worker.c (1384): service failed, worker tomcat2 is in error state
页: [1] 2
查看完整版本: 渴望高手赐教!tomcat+apache+mod_jk连接,出现500错误解决方法!