1

好吧,朋友们,我是一种新手,所以这听起来可能是一个基本或相对简单的问题。我要做的只是:我使用 JSP 开发了一个小型应用程序,Servlets 使用 tomcat5.5.35 将它部署在网络中的一台机器上。它工作得很好,我可以看到 JSP/Servlets 按预期运行。现在我想用 PHP 开发剩余的页面,并使用 Apache 和 tomcat 连接器将 PHP 和 JSP/Servlets 集成在一起。

Apache 版本 - 2.2.22 win 32 x86 无 ssl。Tomcat 连接器 - tomcat-connectors-1.2.36-windows-i386-httpd-2.2.x

I called a php script from PHP Directory and it got displayed as expected. 

问题陈述: Apache 没有将 JSP 和 Servlet 转发到 tomcat。

将 mod_jk.so 复制到 /modules

我创建了worker.properties并将其复制到 \conf 目录下,内容如下

worker.list=worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=300 

修改 httpd.conf 为

DocumentRoot "C:/Program Files/Apache Software Foundation/Apache2.2/htdocs"
ServerName localhost:80
<ifmodule mod_jk.c>
JkWorkersFile /etc/apache2/workers.properties
JkLogFile /var/log/apache2/mod_jk.log
 JkLogLevel DEBUG
</ifmodule>

LoadModule    jk_module  "C:/Program Files/Apache Software Foundation/Apache2.2/modules/mod_jk.so"
JkWorkersFile "C:/Program Files/Apache Software Foundation/Apache2.2/conf/workers.properties"
JkShmFile "C:/Program Files/Apache Software Foundation/Apache2.2/logs/mod_jk.shm"
JkLogFile "C:/Program Files/Apache Software Foundation/Apache2.2/logs/mod_jk.log"
JkLogLevel    debug
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "
<VirtualHost *:80>
DocumentRoot "C:/Program Files/apache-tomcat-5.5.35/webapps/automationutil"
SetEnvIf Request_URI \.php no-jk
SetEnvIf Request_URI \.cgi no-jk
JkMount  /* worker1
JkMount  /*.jsp worker1
</VirtualHost>

用于 tomcat 的 server.xml

tomcat 日志不显示任何错误,而我可以在 mod_jk.logs 中看到以下内容

1:06:16 2012] [5580:3828] [debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1131): Attempting to map URI '/automationutil/pages/loginrelated.html' from 0 maps
[Wed May 16 21:06:16 2012] [5580:3828] [debug] jk_translate::mod_jk.c (3723): no match for /automationutil/pages/loginrelated.html found
[Wed May 16 21:06:16 2012] [5580:3828] [debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1131): Attempting to map URI '/automationutil/pages/loginrelated.html' from 0 maps
[Wed May 16 21:06:16 2012] [5580:3828] [debug] jk_map_to_storage::mod_jk.c (3798): no match for /automationutil/pages/loginrelated.html found
[Wed May 16 21:06:16 2012] [5580:3828] [debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1131): Attempting to map URI '/automationutil/pages/loginfooter.html' from 0 maps
[Wed May 16 21:06:16 2012] [5580:3828] [debug] jk_translate::mod_jk.c (3723): no match for /automationutil/pages/loginfooter.html found
[Wed May 16 21:06:16 2012] [5580:3828] [debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1131): Attempting to map URI '/automationutil/pages/loginfooter.html' from 0 maps
[Wed May 16 21:06:16 2012] [5580:3828] [debug] jk_map_to_storage::mod_jk.c (3798): no match for /automationutil/pages/loginfooter.html found
[Wed May 16 21:06:16 2012] [5580:4996] [debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1131): Attempting to map URI '/automationutil/pages/index_settings.jpg' from 0 maps
[Wed May 16 21:06:16 2012] [5580:4996] [debug] jk_translate::mod_jk.c (3723): no match for /automationutil/pages/index_settings.jpg found
[Wed May 16 21:06:16 2012] [5580:4996] [debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1131): Attempting to map URI '/automationutil/pages/index_settings.jpg' from 0 maps
[Wed May 16 21:06:16 2012] [5580:4996] [debug] jk_map_to_storage::mod_jk.c (3798): no match for /automationutil/pages/index_settings.jpg found
[Wed May 16 21:06:23 2012] [5580:4996] [debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1131): Attempting to map URI '/automationutil/pages/helppage.jsp' from 0 maps
[Wed May 16 21:06:23 2012] [5580:4996] [debug] jk_translate::mod_jk.c (3723): no match for /automationutil/pages/helppage.jsp found
[Wed May 16 21:06:23 2012] [5580:4996] [debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1131): Attempting to map URI '/automationutil/pages/helppage.jsp' from 0 maps
[Wed May 16 21:06:23 2012] [5580:4996] [debug] jk_map_to_storage::mod_jk.c (3798): no match for /automationutil/pages/helppage.jsp found
[Wed May 16 21:06:32 2012] [5580:4996] [debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1131): Attempting to map URI '/automationutil/LoginApp' from 0 maps
[Wed May 16 21:06:32 2012] [5580:4996] [debug] jk_translate::mod_jk.c (3723): no match for /automationutil/LoginApp found
[Wed May 16 21:06:32 2012] [5580:4996] [debug] map_uri_to_worker_ext::jk_uri_worker_map.c (1131): Attempting to map URI '/automationutil/LoginApp' from 0 maps
[Wed May 16 21:06:32 2012] [5580:4996] [debug] jk_map_to_storage::mod_jk.c (3798): no match for /automationutil/LoginApp found

我在 web.xml 中有 servlet 的映射,它们在 tomcat 中运行良好。但不确定为什么 apache 没有正确处理它们:(。我们还需要为 JSP 映射吗?

将非常感谢并感谢任何可以让我继续前进的帮助。最近几天在网上搜索,但没有任何收获。

4

0 回答 0