[Java] SSH框架笔记_Struts2配置问题

时间:2022-02-02 15:33:58

1、Unable to load bean: type: class:com.opensymphony.xwork2.ObjectFactory - bean - jar:file:/D:/Program%20Files/apache-tomcat-6.0.35/webapps/StrutsPro/WEB-INF/lib/struts2-core-2.3.4.jar!/struts-default.xml:29:72

是由于tomcat本身的lib就有struts需要的包,而我们又自己添加了包而产生的冲突。

[Java] SSH框架笔记_Struts2配置问题

2、只添加了5个包是不够的xwork-x.x.x.jar、commons-logging-x.x.x.jar、freemarker-x.x.x.jar、ognl-x.x.x.jar、struts2-core-x.x.x.jar)

问题:严重: Dispatcher initialization failed
  java.lang.RuntimeException: java.lang.reflect.InvocationTargetException

解决方法:添加javassist-x.x.x.ga.jar

问题:警告: Could not create JarEntryRevision for
[jar:file:/D:/Program%20Files/apache-tomcat-6.0.35/webapps/StrutsPro/WEB-INF/lib/struts2-core-2.3.4.jar]!
java.lang.NoClassDefFoundError: org/apache/commons/io/FileUtils

解决方法:添加commons-io-x.x.x.jar

问题:严重: Exception starting filter struts2
java.lang.NoClassDefFoundError: org/apache/commons/lang3/StringUtils

解决方法:添加commons-langx.x.x.jar

问题:严重: Dispatcher initialization failed
Unable to load
configuration. - bean -
jar:file:/D:/Program%20Files/apache-tomcat-6.0.35/webapps/StrutsPro/WEB-INF/lib/struts2-core-2.3.4.jar!/struts-default.xml:51:178

Caused by: java.lang.ClassNotFoundException: org.apache.commons.fileupload.RequestContext

解决方法:添加commons-fileupload-x.x.x.jar