Struts 1.1 + Hibernate 3.2 Integration
I am trying to integrate hibernate into an existing struts + ejb 2.0 application. I had to write a struts-hibernate plugin for the session creation from hibernate.cfg.xml. I also created model and hbm files, but I am unable to bring up the application due to the jar files conflict, I guess. I keep getting this exception:
[11/8/10 10:58:59:257 EST] 00000023 ServletWrappe E 开发者_运维百科 SRVE0100E: Did not realize init() exception thrown by servlet action: java.lang.NoClassDefFoundError: org.dom4j.io.OutputFormat
at java.lang.J9VMInternals.verifyImpl(Native Method)
at java.lang.J9VMInternals.verify(J9VMInternals.java:59)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:120)
at org.hibernate.cfg.Configuration.reset(Configuration.java:212)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:197)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:201)
at com.vo.common.struts.utils.HibernatePlugIn.init(HibernatePlugIn.java:47)
at org.apache.struts.action.ActionServlet.initModulePlugIns(ActionServlet.java:1158)
at org.apache.struts.action.ActionServlet.init(ActionServlet.java:473)
at javax.servlet.GenericServlet.init(GenericServlet.java:256)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:185)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.init(ServletWrapper.java:316)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.initialize(ServletWrapper.java:1119)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.initialize(ServletWrapper.java:149)
Do you have dom4j on your classpath?
The problem is that in your web project, there is no dom4j-1.6.1.jar inside WEB-INF/lib
folder. Place the jar there, rebuild your project (I'm assuming EAR file) and redeploy it to WAS (if I'm correct).
Having the dom.jar in your classpath helps only Eclipse in managing classpaths of class files when doing development but building your JAR/WAR/EAR files, you have to manage your libraries (which you can configure in Eclipse too).
Yes I got it, the problem was with classpath, but not the web-inf/lib, but server class path where in the server.xml also need to have the set of jars that are needed by the application.
Thank you very much.
精彩评论