struts2配置问题总结,struts2.3.1+MyEclipse6.5+Tomcat6.0
1、
?
FilterDispatcher
?
容易写错,今天就犯了这个错误
<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>
2、今天第一次搭建struts2框架遇到的问题:
严重: Dispatcher initialization failed
Unable to load configuration. - bean - jar:file:/D:/server/tomcat/webapps/webtestexample/WEB-INF/lib/struts2-gxp-plugin-2.3.1.2.jar!/struts-plugin.xml:8:162
Caused by: Unable to load configuration. - bean - jar:file:/D:/server/tomcat/webapps/webtestexample/WEB-INF/lib/struts2-gxp-plugin-2.3.1.2.jar!/struts-plugin.xml:8:162
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:69)
at org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispatcher.java:390)
at org.apache.struts2.dispatcher.Dispatcher.init(Dispatcher.java:436)
... 28 more
Caused by: Unable to load bean: type:org.apache.struts2.views.gxp.inject.InjectedObjectContainer class:org.apache.struts2.views.gxp.inject.InjectedObjectContainer - bean - jar:file:/D:/server/tomcat/webapps/webtestexample/WEB-INF/lib/struts2-gxp-plugin-2.3.1.2.jar!/struts-plugin.xml:8:162
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:235)
at org.apache.struts2.config.StrutsXmlConfigurationProvider.register(StrutsXmlConfigurationProvider.java:102)
at com.opensymphony.xwork2.config.impl.DefaultConfiguration.reloadContainer(DefaultConfiguration.java:180)
at com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(ConfigurationManager.java:66)
... 30 more
Caused by: java.lang.ClassNotFoundException: org.apache.struts2.views.gxp.inject.InjectedObjectContainer
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at com.opensymphony.xwork2.util.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:157)
at com.opensymphony.xwork2.config.providers.XmlConfigurationProvider.register(XmlConfigurationProvider.java:206)
... 33 more
2012-2-10 15:41:32 org.apache.catalina.core.StandardContext start
严重: Error filterStart
2012-2-10 15:41:32 org.apache.catalina.core.StandardContext start
严重: Context [/webtestexample] startup failed due to previous errors
解决思路方法:
删除工程,在新建的工程中只导入如下包:
xwork-core-2.3.1.2.jar
commons-logging-1.1.1.jar
freemarker-2.3.18.jar
ognl-3.0.4.jar
struts-core-2.3.1.2.jar
commons-io-2.0.1.jar
commons-fileupload-1.2.2.jar
javassist-3.11.0.GA.jar
commons-lang-2.5.jar
3、
Could not create JarEntryRevision for [jar:file:/D:/server/tomcat/webapps/we
可能没有引入commons-io-1.x.x.jar包、和commons-fileupload-1.2.2.jar
导入后重新部署工程
4、
严重: Exception starting filter struts2
java.lang.NoClassDefFoundError: org/apache/commons/lang/StringUtils
需要下述包
javassist-3.11.0.GA.jar
commons-lang-2.5.jar
commons-io-2.0.1.jar
1 楼 ShorenG 2012-04-25 最后一条 4 不管用