tomcat启动时struts2出错问题

来源:互联网 发布:淘宝代销如何交保证金 编辑:程序博客网 时间:2024/05/22 17:31

刚开始使用Struts2,第一个下载的例子就出错。

Unable to load bean: type:com.opensymphony.xwork2.ObjectFactory class:org.apache.struts2.spring.StrutsSpringObjectFactory - bean - jar:file:/D:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/testStruts/WEB-INF/lib/struts2-spring-plugin-2.0.6.jar!/struts-plugin.xml:8:132
        at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:208)
 at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:101)

Caused by: java.lang.NoClassDefFoundError: org/springframework/context/ApplicationContextAware 

原来是spring插件的问题。如果没有spring组件就会出错。

解决方法:把struts2中默认的jar中与spring相关的去掉(也可以只把用到的留下)就OK了。

原创粉丝点击