Struts2常见错误

java.lang.NoSuchMethodError: com.opensymphony.xwork2.config.ConfigurationManager.addContainerProvider(Lcom/opensymphony/xwork2/config/ContainerProvider;)V
 at org.apache.struts2.dispatcher.Dispatcher.init_DefaultProperties(Dispatcher.java:310)
 at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:430)
 at org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.java:193)
 at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
 at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:422)
 at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
 at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4071)
 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4725)
 at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
 at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
 at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
 at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1079)
 at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:1002)
 at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:506)
 at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1315)
 at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:324)
 at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1061)
 at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
 at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
 at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
 at org.apache.catalina.core.StandardService.start(StandardService.java:525)
 at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
 at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
 at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
2012-7-19 14:35:23 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2012-7-19 14:35:23 org.apache.catalina.core.StandardContext start
严重: Context [/forum] startup failed due to previous errors
2012-7-19 14:35:23 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext

org.apache.struts2.dispatcher.FilterDispatcher is now deprecated。因此,需要将web.xml中的配置做如下修改:

  <filter>
  <filter-name>struts2</filter-name>
  <filter-class>
     org.apache.struts2.dispatcher.FilterDispatcher
  </filter-class>
  </filter>
改为

  <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
  </filter>

你可能感兴趣的:(web.xml,struts)