两个问题
一、启动的时候怎么报这样的错
2010-9-25 10:45:28 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter struts2
Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/D:/apache-tomcat-6.0.26/webapps/s2/WEB-INF/lib/struts2-core-2.1.8.1.jar!/struts-default.xml:29:72
二、
用struts2的令牌机制,JSP里面加入 <s:token></s:token>
为什么提示这样的错?
严重: Servlet.service() for servlet jsp threw exception
The Struts dispatcher cannot be found.  This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]
at org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:60)

这是什么意思?
包已经都是全的,没有落下

解决方案 »

  1.   

    The Struts dispatcher cannot be found
    你的应用的web.xml没有定义FilterDispatcher
    <filter>
            <filter-name>struts</filter-name>
            <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
            <init-param>
             <param-name>actionPackages</param-name>
             <param-value>org.apache.struts2.showcase.person</param-value>
            </init-param>
        </filter>
      

  2.   

    <s:token></s:token>
    还是提示这个
    严重: Servlet.service() for servlet jsp threw exception
    The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]
    at org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:60)
      

  3.   

    我把包删到了就剩五个struts2核心的和ONGL Xwork
    还是不行
      

  4.   

    struts2.1.8中,tomcat的路径不能含有空格,你检查一下。
      

  5.   

    解决了没,也可能是WEBROOT里面别的项目有问题
      

  6.   

    web.xml 中这么配的  <filter>
       <filter-name>struts2</filter-name>
       <filter-class>
       org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
       </filter-class>
      </filter>
      <filter-mapping>
       <filter-name>struts2</filter-name>
       <url-pattern>*.action</url-pattern>
      </filter-mapping>
      

  7.   

    struts.xml<struts>
    <package name="test" extends="struts-default" namespace="/test" >
    <interceptors> <!-- 拦截器  -->
    <interceptor name="test" class="com.david.inteceptor.Inte">
       <param name="excludeMethods">test</param>
    <!--  <param name="includeMethods">test1,test2</param>       -->  
    </interceptor>
    </interceptors>

    <global-results>
    <result name="suc">/suc.jsp</result>
    <result name="login">/login.jsp</result>
    <result name="global-exception">/error.jsp</result>
    </global-results> <global-exception-mappings>
    <exception-mapping result="global-exception" exception="java.lang.Exception"></exception-mapping>
    </global-exception-mappings>

    <action name="*_*" class="com.david.test.{1}Action" method="{2}">
        <result name="loginsuc" >/loginsuc.jsp</result>
        <interceptor-ref name="test"></interceptor-ref>
        <interceptor-ref name="token"></interceptor-ref>
        <result name="invalid.token">/wait.jsp</result>
        <interceptor-ref name="token"></interceptor-ref>
        <interceptor-ref name="defaultStack"></interceptor-ref>
        <!-- 
        <result name="wait">/wait.jsp</result>
    <interceptor-ref name="defaultStack"></interceptor-ref>
    <interceptor-ref name="execAndWait"></interceptor-ref>
     -->
     
    </action>
    </package>
    <package name="test1" extends="struts-default" namespace="/fuck" >
    <action name="*_*" class="com.david.test.{1}Action" method="{2}">
    <result name="aa" >/aa.jsp</result>
    </action>
    </package>
    <package name="test2" extends="test" namespace="/fuck" >
    <action name="*_*" class="com.david.test.{1}Action" method="{2}">
    <result name="aa" >/aa.jsp</result>
    </action>
    </package>

    </struts>    
      

  8.   

    第一个问题:应该是没有导入struts2-spring-pluging.jar这个包
    第二个问题:含有struts标签的jsp页面,不能直接请求,必须经过struts2过滤器。楼主可统一通过action跳转到页面。或者在web.xml中,配置struts2的响应所有请求<filter>
          <filter-name>struts2</filter-name>
          <filter-class>
              org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
          </filter-class>
      </filter>
      <filter-mapping>
          <filter-name>struts2</filter-name>
          <url-pattern>/*</url-pattern>
      </filter-mapping>
      

  9.   

    如果项目中没有用到spring,可以在struts.properties文件中,将struts.objectFactory这一行注释掉。