struts2.1+spring2.5+hibernate3框架搭建时出现的错误及解决办法

    技术2022-05-13  13

    课堂上一直讲的是struts2.0.14和spring2.5的整合,今天有学生问struts2.1整合时的一些错误,列举一下解决办法吧:

     

     1.java.lang.RuntimeException: java.lang.RuntimeException: com.opensymphony.xwork2.inject.DependencyException:

    com.opensymphony.xwork2.inject.ContainerImpl$MissingDependencyException: No mapping found for dependency [type=java.lang.String, name='actionPackages'] in public void org.apache.struts2.config.ClasspathPackageProvider.setActionPackages(java.lang.String). at com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilder.java:132)     at com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:51) ......

    解决办法:删除struts2-codebehind-plugin包 2.严重: Actual exception Could not load class org.apache.struts2.jsf.FacesSetupInterceptor. Perhaps it exists but certain dependencies are not available? - interceptor - jar:file:/D:/ghl/apache-tomcat-6.0.20/wtpwebapps/SS/WEB-INF/lib/struts2-jsf-plugin-2.1.8.1.jar!/struts-plugin.xml:35:97 at com.opensymphony.xwork2.ObjectFactory.buildInterceptor(ObjectFactory.java:202)

    ......解决办法:删除struts2-jsf-plugin-2.1.8.1.jar

    3.

    严重: Actual exception

    Could not load class org.apache.struts2.portlet.interceptor.PortletAwareInterceptor. Perhaps it exists but certain dependencies are not available? - interceptor - jar:file:/E:/Program Files/apache-tomcat-6.0.16/webapps/Bysj_douxinchun/WEB-INF/lib/struts2-portlet-plugin-2.2.1.jar!/struts-plugin.xml:48:114

    ......

    解决办法:删除struts2-portlet-plugin-2.1.8.1.jar 4.asm包的问题,估计是重复,去掉asm2.2.3.jar。 5.osgi包的问题,报错,解决办法:全部删除。

    4.在使用form表单时,如果用action=*.action;会报404,去掉".action",这一点恰好与2.0相反。

    6.一个常见的hibernate错误: org.springframework.orm.hibernate3.HibernateSystemException: a different object with the same identifier value was already associated with the session 出错原因:我在关联的双方都设置了cascade,解决办法:去掉<many-to-one>属性中的cascade属性。


    最新回复(0)