蓝森林首页 | 返回主页 | 本站地图 | 站内搜索 | 联系信箱 |
 您目前的位置:首页 > 自由软件 > 技术交流 > 系统管理


    

蓝森林 http://www.lslnet.com 2006年5月28日 19:08


[求助]配置Apache和Tomcat整合时为什么出现404错误?

OS环境 RedHat 7.2
Apache 1.3.27 Tomcat 4.1.30 mod_jk1.3
按照网上说的安装之后,在webapps下建立了一个目录bbs,并向这个目录复制了一个网上免费的bbs论坛。
启动tomcat和apache,输入ip可以看到apache的页面,加上8080可以看到tomcat的页面。
我在我的host里做了一个映射 192.168.1.13 www.bbs.com
现在输入 www.bbs.com 可以浏览目录,点击test.html,可以看到输出的内容,但是点击test.jsp,就报404错误,无法找到该页面?
那位高手帮帮忙,是那里配置的有问题?Apache?还是Tomcat?
------------------------------
Apache的httpd.conf 增加的内容。
<IfDefine HAVE_JK>;
   LoadModulejk_modulemodules/mod_jk.so
   Include/etc/httpd/conf/mod_jk.conf
</IfDefine>;
<VirtualHost *>;
DocumentRoot /var/tomcat4/webapps/bbs
ServerName www.bbs.com
JkMount /*.jsp ajp13
</VirtualHost>;


mod_jk.conf
JkWorkersFile /etc/httpd/conf/workers.properties
JkLogFile     /var/log/httpd/mod_jk.log
JkLogLevel error
<Directory "/var/tomcat4/webapps/bbs">;
Options Indexes FollowSymLinks
</Directory>;
<Location"/WEB-INF">;
AllowOverride None
deny from all
</Location>;


server.xml
<Host name="www.bbs.com" debug="0" appBase="webapps"  unpackWARs="true" autoDeploy="true">;
<Context path="" docBase="bbs" debug="0"  reloadable="true" crossContext="true">;
</Context>;
</Host>;

  :idea:

[求助]配置Apache和Tomcat整合时为什么出现404错误?

下面是mod_jk.log的信息。
----------------------------------------------
[Sun Jun 06 06:56:06 2004]  [jk_uri_worker_map.c (477)]: Attempting to map URI '/bbs/index.jsp'
[Sun Jun 06 06:56:06 2004]  [jk_uri_worker_map.c (558)]: jk_uri_worker_map_t::map_uri_to_worker, Found a suffix match ajp13 ->; *.jsp
[Sun Jun 06 06:56:06 2004]  [jk_worker.c (132)]: Into wc_get_worker_for_name ajp13
[Sun Jun 06 06:56:06 2004]  [jk_worker.c (136)]: wc_get_worker_for_name, done  found a worker
[Sun Jun 06 06:56:06 2004]  [jk_ajp_common.c (1546)]: Into jk_worker_t::get_endpoint
[Sun Jun 06 06:56:06 2004]  [jk_ajp_common.c (1208)]: Into jk_endpoint_t::service
[Sun Jun 06 06:56:06 2004]  [jk_ajp_common.c (295)]: Into ajp_marshal_into_msgb
[Sun Jun 06 06:56:06 2004]  [jk_ajp_common.c (463)]: ajp_marshal_into_msgb - Done
[Sun Jun 06 06:56:06 2004]  [jk_connect.c (158)]: Into jk_open_socket
[Sun Jun 06 06:56:06 2004]  [jk_connect.c (165)]: jk_open_socket, try to connect socket = 7
[Sun Jun 06 06:56:06 2004]  [jk_connect.c (174)]: jk_open_socket, after connect ret = 0
[Sun Jun 06 06:56:06 2004]  [jk_connect.c (183)]: jk_open_socket, set TCP_NODELAY to on
[Sun Jun 06 06:56:06 2004]  [jk_connect.c (200)]: jk_open_socket, return, sd = 7
[Sun Jun 06 06:56:06 2004]  [jk_ajp_common.c (661)]: In jk_endpoint_t::ajp_connect_to_endpoint, connected sd = 7
[Sun Jun 06 06:56:06 2004]  [jk_ajp_common.c (693)]: sending to ajp13 #553
[Sun Jun 06 06:56:06 2004]  [jk_ajp_common.c (966)]: ajp_send_request 2: request body to send 0 - request body to resend 0
[Sun Jun 06 06:56:06 2004]  [jk_ajp_common.c (804)]: received from ajp13 #41
[Sun Jun 06 06:56:06 2004]  [jk_ajp_common.c (515)]: ajp_unmarshal_response: status = 404
[Sun Jun 06 06:56:06 2004]  [jk_ajp_common.c (521)]: ajp_unmarshal_response: Number of headers is = 2
[Sun Jun 06 06:56:06 2004]  [jk_ajp_common.c (575)]: ajp_unmarshal_response: Header[0] [Content-Type] = [text/html]
[Sun Jun 06 06:56:06 2004]  [jk_ajp_common.c (575)]: ajp_unmarshal_response: Header[1] [Content-Language] = [en-US]
[Sun Jun 06 06:56:06 2004]  [jk_ajp_common.c (804)]: received from ajp13 #711
[Sun Jun 06 06:56:06 2004]  [jk_ajp_common.c (804)]: received from ajp13 #2
[Sun Jun 06 06:56:06 2004]  [jk_ajp_common.c (1521)]: Into jk_endpoint_t::done, recycling connection
[Sun Jun 06 06:56:06 2004]  [jk_uri_worker_map.c (460)]: Into jk_uri_worker_map_t::map_uri_to_worker
[Sun Jun 06 06:56:06 2004]  [jk_uri_worker_map.c (477)]: Attempting to map URI '/favicon.ico'
[Sun Jun 06 06:56:06 2004]  [jk_uri_worker_map.c (599)]: jk_uri_worker_map_t::map_uri_to_worker, done without a match
[Sun Jun 06 06:56:09 2004]  [jk_uri_worker_map.c (460)]: Into jk_uri_worker_map_t::map_uri_to_worker
[Sun Jun 06 06:56:09 2004]  [jk_uri_worker_map.c (477)]: Attempting to map URI '/favicon.ico'
[Sun Jun 06 06:56:09 2004]  [jk_uri_worker_map.c (599)]: jk_uri_worker_map_t::map_uri_to_worker, done without a match

[求助]配置Apache和Tomcat整合时为什么出现404错误?

看起来好像是静态页面apache都解析了,但是到*.jsp的页面,tomcat就找不到路径?是不是要在server.xml里写一些配置呢?

[求助]配置Apache和Tomcat整合时为什么出现404错误?

有几处设置没有贴上来,不知是否已做修改。
下面是Tomcat的设置修正
server.xml
...
<Context path="" docBase="[color=darkred]/var/tomcat4/webapps/bbs[/color]" debug="0" reloadable="true" crossContext="true">;
</Context>;
...

[求助]配置Apache和Tomcat整合时为什么出现404错误?

按照Liu_xp2003兄说的,提示的是500错误,如果不加上,是404错误。
加上之后mod_jk.log报的是不能链接到tomcat上,我已经打开了ipchains里有关server.xml中提到的所有链接了。
是不是和我注释掉了server.xml中的8080端口有关呢?
去掉注释试试看。

[求助]配置Apache和Tomcat整合时为什么出现404错误?

唉,还是404错误啊.......
明天早上趁着心情好再去试试吧....

请问有谁解决这个问题了?我在win2003 IIS6+jdk+tomcat5.5也是这样,在http://localhost:8080/index.jsp可以使用,http://localhsost:8080/index.html可以使用,http://localhost:80/index.html可以使用,http://localhost:80/index.jsp却提示无法找到该页,我的CPU是XEON,可是我没有看到tomcat connector有64位windows版-_-

APACHE和TOMCAT没有整合成功

是啊,可是我不知道是哪里出了问题....应用程序日志里面什么都没有,faint~~~

难道是我下载的connector不对?可是我在ISAPI筛选器里看到的jakarta状态正常,优先级是高,并且在服务器扩展里面也加上jakarta了

你把你你的那个work-properties贴出来看看!

[code]
[shm]
file=D:\Logs\Tomcat/jk2.log
size=1048576
# Example socket channel, override port and host.
[channel.socket:localhost:8009]
port=8009
host=localhost
# define the worker
[ajp13:localhost:8009]
channel=channel.socket:localhost:8009
# Uri mapping
[uri:/*.jsp]
[uri:/myweb/*.jsp]
worker=ajp13:localhost:8009
# define the worker
[status:status]
# Uri mapping
[uri:/jkstatus/*]
worker=status:status
[/code]

我在iis里面加上.jsp的应用程序后,现在访问.jsp是这样一个错误页面,访问html仍然正常,在8080端口访问.jsp和.html也正常。
错误如下:

[code]
无法显示网页
您正在查找的页当前不可用。 网站可能遇到支持问题,或者您需要 调整您的浏览器设置。

--------------------------------------------------------------------------------

请尝试以下操作:

单击  刷新按钮,或稍后重试。

如果您已经在地址栏中输入该网页的地址, 请确认其拼写正确。

要检查您的网络连接,请单击工具菜单,然后单击 Internet 选项。在连接选项卡上,单击设置。 设置必须与您的局域网 (LAN) 管理员或 Internet 服务供应商 (ISP) 提供的一致。
查看您的 Internet 连接设置是否正确被检测。您可能设置让 Microsoft Windows 检查您的网站并自动发现网络连接设置(如果您的网络管理员已经启用此设置)。
单击工具菜单,然后单击Internet 选项。
在连接选项卡上,单击LAN 设置。
选择自动检测设置,然后单击确定。
某些站点要求 128-位的连接安全性。单击帮助菜单,然后单击关于 Internet Explorer 可以查看您所安装的安全强度。
如果您要访问某安全站点,请确保您的安全设置能够支持。请单击工具菜单,然后单击 Internet 选项。在“高级”选项卡上,滚动到“安全”部分,复选 SSL 2.0、SSL 3.0、TLS 1.0、PCT 1.0 设置。
单击上一步按钮,尝试其他链接。


找不到服务器或 DNS 错误
Internet Explorer  


[/code]

如果方便的话,你把你的server.xml在<Host name="">..</Host>以前的所有部分贴出来让我看看

挺方便的:D,我只是在tomcat的server.xml里面建立了myweb这样一个虚拟目录,改了一下host的appbase,不知道有没有影响?可是我的8080端口访问起来没有问题@_@

[code]
      <Host name="localhost" appBase="D:\wwwroot"
       unpackWARs="true" autoDeploy="true"
       xmlValidation="false" xmlNamespaceAware="false">

        <Context path="" docBase="D:\wwwroot\" debug="0" reloadable="true" crossContext="true" />
        <Context path="/myweb" docBase="D:\wwwroot\myweb" debug="0" reloadable="true" crossContext="true"> </Context>

      </Host>
[/code]

谢谢帮忙^^

还有这是注册表:
[code]
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Jakarta Isapi Redirector]

[HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\Jakarta Isapi Redirector\2.0]
"serverRoot"="\"C:\\Program Files\\Apache Software Foundation\\Tomcat 5.5\""
"extensionUri"="/jakarta/isapi_redirector2.dll"
"workersFile"="\"C:\\Program Files\\Apache Software Foundation\\Tomcat 5.5\\conf\\workers2.properties\""
"logLevel"="DEBUG"


[/code]

你没有明白我的意思哟,兄弟,我是说从server.xml整个文件的最开头到<HOST>之间的那部分内容呀,

晕菜~~~我看花眼了,以前的内容我还没有改^_^

这个注释好乱阿,我不敢随便删了:em06:全贴出来^^
[code]

<Server port="8005" shutdown="SHUTDOWN">

  <!-- Comment these entries out to disable JMX MBeans support used for the
       administration web application -->
  <Listener className="org.apache.catalina.core.AprLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" />
  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" />
  <Listener className="org.apache.catalina.storeconfig.StoreConfigLifecycleListener"/>

  <!-- Global JNDI resources -->
  <GlobalNamingResources>

    <!-- Test entry for demonstration purposes -->
    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>

    <!-- Editable user database that can also be used by
         UserDatabaseRealm to authenticate users -->
    <Resource name="UserDatabase" auth="Container"
              type="org.apache.catalina.UserDatabase"
       description="User database that can be updated and saved"
           factory="org.apache.catalina.users.MemoryUserDatabaseFactory"
          pathname="conf/tomcat-users.xml" />

  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share
       a single "Container" (and therefore the web applications visible
       within that Container).  Normally, that Container is an "Engine",
       but this is not required.

       Note:  A "Service" is not itself a "Container", so you may not
       define subcomponents such as "Valves" or "Loggers" at this level.
   -->

  <!-- Define the Tomcat Stand-Alone Service -->
  <Service name="Catalina">

    <!-- A "Connector" represents an endpoint by which requests are received
         and responses are returned.  Each Connector passes requests on to the
         associated "Container" (normally an Engine) for processing.

         By default, a non-SSL HTTP/1.1 Connector is established on port 8080.
         You can also enable an SSL HTTP/1.1 Connector on port 8443 by
         following the instructions below and uncommenting the second Connector
         entry.  SSL support requires the following steps (see the SSL Config
         HOWTO in the Tomcat 5 documentation bundle for more detailed
         instructions):
         * If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or
           later, and put the JAR files into "$JAVA_HOME/jre/lib/ext".
         * Execute:
             %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)
             $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA  (Unix)
           with a password value of "changeit" for both the certificate and
           the keystore itself.

         By default, DNS lookups are enabled when a web application calls
         request.getRemoteHost().  This can have an adverse impact on
         performance, so you can disable it by setting the
         "enableLookups" attribute to "false".  When DNS lookups are disabled,
         request.getRemoteHost() will return the String version of the
         IP address of the remote client.
    -->

    <!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
    <Connector
port="8080"               maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" redirectPort="8443" acceptCount="100"
               connectionTimeout="20000" disableUploadTimeout="true" />
    <!-- Note : To disable connection timeouts, set connectionTimeout value
     to 0 -->
       
        <!-- Note : To use gzip compression you could set the following properties :
       
                           compression="on"
                           compressionMinSize="2048"
                           noCompressionUserAgents="gozilla, traviata"
                           compressableMimeType="text/html,text/xml"
        -->

    <!-- Define a SSL HTTP/1.1 Connector on port 8443 -->
    <!--
    <Connector port="8443" maxHttpHeaderSize="8192"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" disableUploadTimeout="true"
               acceptCount="100" scheme="https" secure="true"
               clientAuth="false" sslProtocol="TLS" />
    -->

    <!-- Define an AJP 1.3 Connector on port 8009 -->
    <Connector port="8009"
               enableLookups="false" redirectPort="8443" protocol="AJP/1.3" />

    <!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->
    <!-- See proxy documentation for more information about using this. -->
    <!--
    <Connector port="8082"
               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
               enableLookups="false" acceptCount="100" connectionTimeout="20000"
               proxyPort="80" disableUploadTimeout="true" />
    -->

    <!-- An Engine represents the entry point (within Catalina) that processes
         every request.  The Engine implementation for Tomcat stand alone
         analyzes the HTTP headers included with the request, and passes them
         on to the appropriate Host (virtual host). -->

    <!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">         
    -->
         
    <!-- Define the top level container in our container hierarchy -->
    <Engine name="Catalina" defaultHost="localhost">

      <!-- The request dumper valve dumps useful debugging information about
           the request headers and cookies that were received, and the response
           headers and cookies that were sent, for all requests received by
           this instance of Tomcat.  If you care only about requests to a
           particular virtual host, or a particular application, nest this
           element inside the corresponding <Host> or <Context> entry instead.

           For a similar mechanism that is portable to all Servlet 2.4
           containers, check out the "RequestDumperFilter" Filter in the
           example application (the source for this filter may be found in
           "$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").

           Request dumping is disabled by default.  Uncomment the following
           element to enable it. -->
      <!--
      <Valve className="org.apache.catalina.valves.RequestDumperValve"/>
      -->

      <!-- Because this Realm is here, an instance will be shared globally -->

      <!-- This Realm uses the UserDatabase configured in the global JNDI
           resources under the key "UserDatabase".  Any edits
           that are performed against this UserDatabase are immediately
           available for use by the Realm.  -->
      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"
             resourceName="UserDatabase"/>

      <!-- Comment out the old realm but leave here for now in case we
           need to go back quickly -->
      <!--
      <Realm className="org.apache.catalina.realm.MemoryRealm" />
      -->
[/code]

<!-- You should set jvmRoute to support load-balancing via AJP ie :
    <Engine name="Standalone" defaultHost="localhost" jvmRoute="jvm1">         
    -->
就说要启用这一行,同时,把jvm1改成你在work.propeties里设置的ajp13,同时
注释掉下面的那个<Engine name="catanila">...

可是这个好像是负载均衡的?不管怎么着了,先试试再说:)

仍然不能访问不加8080端口的页面:em16:,我的那个connector好像不起作用?搞不懂IIS6...



Copyright © 1999-2000 LSLNET.COM. All rights reserved. 蓝森林网站 版权所有。 E-mail : webmaster@lslnet.com