我配置SSH2框架。。启动tomcat一切正常。。http://localhost:8080/也正常显示。。
只是加入项目后就总显示The requested resource (/Struts2/) is not available.了我已经在C:\Tomcat 5.5\conf\Catalina\localhost下添加了部署文件:
<?xml version="1.0" encoding="utf-8" ?> 
  <Context path="/Struts2" docBase="C:\Documents and Settings\admin\workspace\Struts2\WebRoot" debug="0" privileged="true" /> 我写过测试文件。。SSH框架应该算是OK的。。这个是web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<display-name>Struts2</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list> <display-name>Struts2</display-name> <welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list> <context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/classes/applicationContext.xml</param-value>
</context-param> <filter>
<filter-name>struts2</filter-name>
    <filter-class>
     org.apache.struts2.dispatcher.FilterDispatcher
    </filter-class>
   </filter> 
   <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
   </filter-mapping>
  
<listener>
    <listener-class>
     org.springframework.web.context.ContextLoaderListener
    </listener-class> 
   </listener> </web-app>请问大侠我应该是哪里出错了呢。。

解决方案 »

  1.   

    <Context path="/Struts2" docBase="C:\Documents and Settings\admin\workspace\Struts2\WebRoot" debug="0" privileged="true" />   这个路径 你在检查检查
      

  2.   

    <display-name>Struts2</display-name>
    <welcome-file-list>
    <welcome-file>index.html</welcome-file>
    <welcome-file>index.htm</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>default.html</welcome-file>
    <welcome-file>default.htm</welcome-file>
    <welcome-file>default.jsp</welcome-file>
    </welcome-file-list><display-name>Struts2</display-name>这一段删了
      

  3.   

    建议把Context节点的信息,写到 TOMCAT_HOME\conf\server.xml 中去。另外:Tomcat启动的时候,没有任何 警告 信息么?密切关注下。
      

  4.   


    2012/07/20 16:14:18 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
    情報: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:/Program Files/Java/jre6/lib/i386;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Java\jdk1.6.0_30\bin;C:\mySql 5.0\bin;C:\Documents and Settings\admin\デスクトップ\eclipse;;.
    2012/07/20 16:14:18 org.apache.coyote.http11.Http11BaseProtocol init
    情報: Coyote HTTP/1.1を http-8080 で初期化します
    2012/07/20 16:14:18 org.apache.catalina.startup.Catalina load
    情報: Initialization processed in 297 ms
    2012/07/20 16:14:18 org.apache.catalina.core.StandardService start
    情報: サービス Catalina を起動します
    2012/07/20 16:14:18 org.apache.catalina.core.StandardEngine start
    情報: Starting Servlet Engine: Apache Tomcat/5.5.20
    2012/07/20 16:14:18 org.apache.catalina.core.StandardHost start
    情報: XML検証は無効です
    log4j:WARN No appenders could be found for logger (org.apache.commons.digester.Digester.sax).
    log4j:WARN Please initialize the log4j system properly.
    2012/07/20 16:14:20 org.apache.catalina.core.ApplicationContext log
    情報: org.apache.webapp.balancer.BalancerFilter: init(): ruleChain: [org.apache.webapp.balancer.RuleChain: [org.apache.webapp.balancer.rules.URLStringMatchRule: Target string: News / Redirect URL: http://www.cnn.com], [org.apache.webapp.balancer.rules.RequestParameterRule: Target param name: paramName / Target param value: paramValue / Redirect URL: http://www.yahoo.com], [org.apache.webapp.balancer.rules.AcceptEverythingRule: Redirect URL: http://jakarta.apache.org]]
    2012/07/20 16:14:20 org.apache.catalina.core.ApplicationContext log
    情報: ContextListener: contextInitialized()
    2012/07/20 16:14:20 org.apache.catalina.core.ApplicationContext log
    情報: SessionListener: contextInitialized()
    2012/07/20 16:14:20 org.apache.catalina.core.ApplicationContext log
    情報: ContextListener: contextInitialized()
    2012/07/20 16:14:20 org.apache.catalina.core.ApplicationContext log
    情報: SessionListener: contextInitialized()
    2012/07/20 16:14:20 org.apache.coyote.http11.Http11BaseProtocol start
    情報: Coyote HTTP/1.1を http-8080 で起動します
    2012/07/20 16:14:20 org.apache.jk.common.ChannelSocket init
    情報: JK: ajp13 listening on /0.0.0.0:8009
    2012/07/20 16:14:20 org.apache.jk.server.JkMain start
    情報: Jk running ID=0 time=0/0  config=null
    2012/07/20 16:14:20 org.apache.catalina.storeconfig.StoreLoader load
    情報: Find registry server-registry.xml at classpath resource
    2012/07/20 16:14:20 org.apache.catalina.startup.Catalina start
    情報: Server startup in 2453 ms这是启动信息。。
      

  5.   

    启动信息没看到问题。怀疑是配置没生效。“建议把Context节点的信息,写到 TOMCAT_HOME\conf\server.xml 中去。”
    ——这步尝试了么?
      

  6.   


    不好意思周末都没上网= =
    谢谢回答哦~~你说的方法我试了下。。<host>标签里添加:<Context path="/Struts2" reloadable="true" docBase="C:\Documents and Settings\admin\workspace\Struts2\WebRoot\jsp" workDir="C:\Documents and Settings\admin\workspace\Struts2\WebRoot" /> 可还是不行。。
      

  7.   


    把eclipse的tomcat配置修改:配置文件读取改成server.xml
    然后又试了一次。。好用了。。十分感谢~~~