如何在 GlassFish 上部署基于 JDO 的 EAR 文件?
我现在真的很绝望,因为我正在构建一个分为几个项目的小应用程序。有一个使用 Vaadin 的 Web 应用程序和一个 EJB 容器,该容器应该使用 JDO 和 DataNucleus 来完成持久性工作。这个hole项目是用Maven构建的,我很高兴现在有一个EAR存档。
EAR 文件的内容对我来说看起来很正确。其中包含所有依赖 JAR,甚至在包含的 WAR 文件中复制。它部署到 GlassFish 服务器时没有任何错误,但是当我调用 URL 时,我收到 javax.jdo.JDOHelper
类的 ClassNotFoundException
。 JAR jdo-api-3.0.jar
存在,但 GlassFish 无法找到它。
但为什么?谁能告诉我吗?请!
...以及堆栈跟踪...;) de.igeri.mmorpg.* 的东西是我的项目。但我想,你已经猜到了。
java.lang.NoClassDefFoundError: javax/jdo/JDOHelper 在de.igeri.mmorpg.common.dao.JDOManager。(JDOManager.java:22) 在de.igeri.mmorpg.common.dao.JDOManager。(JDOManager.java:14) 在 de.igeri.mmorpg.common.dao.BuildingBeanFactory.getAvailable(BuildingBeanFactory.java:29) 在 de.igeri.mmorpg.ui.BuildingUiFactory.getAvailable(BuildingUiFactory.java:26) 在de.igeri.mmorpg.MmorpgApplication.createBuildingsPanel(MmorpgApplication.java:75) 在 de.igeri.mmorpg.MmorpgApplication.createBuildWindow(MmorpgApplication.java:58) 在 de.igeri.mmorpg.MmorpgApplication.createLayout(MmorpgApplication.java:44) 在 de.igeri.mmorpg.MmorpgApplication.init(MmorpgApplication.java:29) 在 com.vaadin.Application.start(Application.java:554) 在com.vaadin.terminal.gwt.server.AbstractApplicationServlet.startApplication(AbstractApplicationServlet.java:1182) 在 com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:466) 在 javax.servlet.http.HttpServlet.service(HttpServlet.java:848) 在 org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1534) 在org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281) 在org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) 在 org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655) 在org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595) 在 com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98) 在 com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91) 在 org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162) 在 org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:326) 在 org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:227) 在 com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:228) 在 com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822) 在 com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719) 在 com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013) 在 com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225) 在 com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) 在 com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) 在 com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) 在 com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) 在com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) 在 com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) 在com.sun.grizzly.ContextTask.run(ContextTask.java:71) 在 com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) 在 com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) 在 java.lang.Thread.run(Thread.java:636) 引起原因:java.lang.ClassNotFoundException:javax.jdo.JDOHelper 在 com.sun.enterprise.loader.ASURLClassLoader.findClassData(ASURLClassLoader.java:808) 在 com.sun.enterprise.loader.ASURLClassLoader.findClass(ASURLClassLoader.java:696) 在 java.lang.ClassLoader.loadClass(ClassLoader.java:321) 在 java.lang.ClassLoader.loadClass(ClassLoader.java:266) ... 37 更多
I'm really desperate right now, because I'm building a little application that is split up into several projects. There is a web application that uses Vaadin and an EJB container that should do the persistance stuff with JDO and DataNucleus. The hole project is build with Maven and I'm happy now that there comes out an EAR archive.
The content of the EAR file looks right to me. There are all dependency JARs in it, even duplicated inside the containing WAR file. It deploys without any error to the GlassFish server, but when I call the URL I get an ClassNotFoundException
for the javax.jdo.JDOHelper
class. The JAR jdo-api-3.0.jar
exists, but GlassFish isn't able to locate it.
But why? Can anyone tell me? Please!
...and the stack trace... ;) The de.igeri.mmorpg.*
stuff ist my project. But I think, you already guessed it.
java.lang.NoClassDefFoundError: javax/jdo/JDOHelper
at de.igeri.mmorpg.common.dao.JDOManager.(JDOManager.java:22)
at de.igeri.mmorpg.common.dao.JDOManager.(JDOManager.java:14)
at de.igeri.mmorpg.common.dao.BuildingBeanFactory.getAvailable(BuildingBeanFactory.java:29)
at de.igeri.mmorpg.ui.BuildingUiFactory.getAvailable(BuildingUiFactory.java:26)
at de.igeri.mmorpg.MmorpgApplication.createBuildingsPanel(MmorpgApplication.java:75)
at de.igeri.mmorpg.MmorpgApplication.createBuildWindow(MmorpgApplication.java:58)
at de.igeri.mmorpg.MmorpgApplication.createLayout(MmorpgApplication.java:44)
at de.igeri.mmorpg.MmorpgApplication.init(MmorpgApplication.java:29)
at com.vaadin.Application.start(Application.java:554)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.startApplication(AbstractApplicationServlet.java:1182)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:466)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1534)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:326)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:227)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:228)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:822)
at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:719)
at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1013)
at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
at java.lang.Thread.run(Thread.java:636)
Caused by: java.lang.ClassNotFoundException: javax.jdo.JDOHelper
at com.sun.enterprise.loader.ASURLClassLoader.findClassData(ASURLClassLoader.java:808)
at com.sun.enterprise.loader.ASURLClassLoader.findClass(ASURLClassLoader.java:696)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
... 37 more
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的建议是将您的 jdo api 和 datanucleus 库作为模块添加到您的应用程序服务器,然后在 Maven 中您可以添加依赖项
并添加 datanucleus maven 插件,如下所示:
然后最重要的部分是您必须将依赖项添加到清单文件中的 datanucleus! !!我很确定在你的情况下这就是问题所在。
在WildFly中你可以这样做:
如果你没有明确使用jca适配器,你可以删除该部分。
或者您可以设置 maven 将部署描述符或清单文件等资源添加到包 INF 目录中。
My suggestion is add your jdo api and datanucleus libs to your app server as a module then in maven you can add dependencies as
and add datanucleus maven plugin like this :
then the most important part you must add your dependency to datanucleus in your manifest file!!! i'm pretty sure that in your case this was the problem.
In WildFly you can do it like this:
If you are not using jca adapter clearly you can delete that part.
Or you can set maven to add your resources such as deployment descriptors or manifest file to your package INF directory.