请高手解答Java(SSH)问题 谢谢啦

来源:百度知道 编辑:UC知道 时间:2024/07/08 20:50:14
在MyEclipse中整合struts+spring+hibernate,我用将struts的action代理给spring的方式,在 struts-config.xml中加入<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property="contextConfigLocation" value="/WEB-INF/applicationContext.xml" />
</plug-in>等.在加入struts能力和spring能力后都可以,加入了hibernate后提示许多包冲突,不过程序还是能够运转,网页能够正常跳转,但是使用Hibernate Reverse Engineering产生VO后,再打开网页运行时显示如下错误:
信息: Initializing WebApplicationContext for Struts ActionServlet 'action', module ''
2009-5-12 17:36:02 org.apache.catalina.core.ApplicationContext log
严重: action: null
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.objectweb.asm.ClassVisitor.visit(IILjava/lang/String;Ljava/lang/String;[Ljava/l

SSH集成会产生包冲突,需要删以下的jar包:
asm.jar
asm-attrt.jar
删除时,先remove再到lib目录下delete
不要删除 cglib-2.1.3.jar 这个包 否则后果会很严重,
我估计是你建工程的顺序错了,应该先建HiberNate (注意不要创建sessionFactory)再建Spring 这时再建sessionFactory 最后添加struts 就可以了

SSH集成会产生包冲突,需要删以下的jar包:
asm.jar
asm-attrt.jar
cglib-2.1.3.jar
删除时,先remove再到lib目录下delete

没删的话会出现以下异常:
Error creating bean with name 'sessionFactory' defined in class path resource [beans.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: com.microsoft.util.UtilDebug.setPrintWriter(Ljava/io/PrintWriter;)V

MyEclipse 服务器那里鼠标右键点一下你的项目,有个选项可以找到你部署的项目的地方,然后去lib目录下 只要删除1个asm-2-2-2 .jar之类的就可以

很经典的问题,或者你可以用get方法得到结果而不是load。。

交给spring管理的时候配置了代理类没?org.springframework.web.struts.DelegatingRequestProcessor
最少是把spring配置sessionfactory的那段发来看看~~