首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2EE开发 >

将struts2跟hibernate组合的时候出现严重: Exception starting filter struts2

2013-09-11 
将struts2和hibernate组合的时候出现严重: Exception starting filter struts2struts.xml文件应该没错的这

将struts2和hibernate组合的时候出现严重: Exception starting filter struts2
struts.xml文件应该没错的 这是struts标签里面的内容
<package name="hibernate" extends="struts-default">
<action name="save" class="com.fyx.action.SavePersonAction" method="savePerson">
</action>

</package>
这是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>

这是tomcat启动的错误信息
严重: Exception starting filter struts2
java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:198)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:180)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:380)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:424)
at org.apache.struts2.dispatcher.ng.InitOperations.initDispatcher(InitOperations.java:69)
at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.init(StrutsPrepareAndExecuteFilter.java:51)
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.start(ContainerBase.java:1053)
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(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.StringUtils
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
... 26 more
2011-9-17 12:41:57 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2011-9-17 12:41:57 org.apache.catalina.core.StandardContext start
严重: Context [/hibernate] startup failed due to previous errors
2011-9-17 12:41:57 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
严重: The web application [/hibernate] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.



[解决办法]
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.StringUtils
是没有找到这个类引起的错误。你仔细找找看看是不是没有添加相应的jar包。就是包括StringUtils里面的jar包
[解决办法]

探讨

可是我加了lang包以后 错误更多了........
这是加了以后
严重: Exception starting filter struts2
Unable to load configuration. - bean - jar:file:/D:/workspace/hi/WebRoot/WEB-INF/lib/struts2-core-2.2.3.jar!/struts-default……

[解决办法]
你用的是最新版本吧 2.2.3在struts2中需要的jar包要9个,你数一下有没有

热点排行