Struts 1.1 + Hibernate 3.2 集成
我正在尝试将 hibernate 集成到现有的 struts + ejb 2.0 应用程序中。我必须编写一个 struts-hibernate 插件来从 hibernate.cfg.xml 创建会话。我还创建了模型和 hbm 文件,但我猜由于 jar 文件冲突,我无法启动该应用程序。我不断收到此异常:
[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)
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)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你的类路径上有 dom4j 吗?
Do you have dom4j on your classpath?
问题是在您的Web项目中,
WEB-INF/lib
文件夹内没有dom4j-1.6.1.jar。将 jar 放在那里,重建您的项目(我假设是 EAR 文件)并将其重新部署到 WAS(如果我是正确的)。在类路径中包含 dom.jar 仅有助于 Eclipse 在进行开发时管理类文件的类路径,但构建 JAR/WAR/EAR 文件时,您必须管理您的库(也可以在 Eclipse 中配置)。
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).
是的,我明白了,问题出在类路径上,但不是 web-inf/lib 上,而是 server.xml 中的服务器类路径也需要具有应用程序所需的 jar 集。
非常感谢。
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.