Tomcat6.0.18下出现The requested resource(/)is not available

来源:互联网 发布:goodsync mac 编辑:程序博客网 时间:2024/05/16 19:45

HTTP Status 404 - /studystruts/


typeStatus report

message/studystruts/

descriptionThe requested resource (/studystruts/) is not available.


Apache Tomcat/6.0.18


Apache Tomcat/6.0.18

 
反复查看了类和配置文件,都没有发现什么错误,后 来将该项目部署到Tomcat5.0下却能正常运行,看来源代码并没有错误。从网上搜索解决该问题的办法,后来发现Tomcat6.0.18与 Tomcat5.0.25的默认配置有一些不同(至于其他的配置有何不同暂未研研),Tomcat6默认是关闭了目录浏览功能的,这个主要是出于安全性的 考虑。
 
对应的配置选项在apache-tomcat-6.0.18/conf/web.xml配置如下:
    <servlet>
        <servlet-name>default</servlet-name>
        <servlet-class>org.apache.catalina.servlets.DefaultServlet</servlet-class>
        <init-param>
            <param-name>debug</param-name>
            <param-value>0</param-value>
        </init-param>
        <init-param>
            <param-name>listings</param-name>
            <param-value>false</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
    </servlet>
 
解决方法:

将其中的
   <init-param>
       <param-name>listings</param-name>
       <param-value>false</param-value>
   </init-param>
设置false改为true,即可开启目录浏览功能

0 0