当我尝试将Java EE应用程序从最新的Eclipse版本(带有Glassfish适配器版本1.7.1的Helios SR2)部署到最新的Glassfish(3.1)时,我遇到了一个奇怪的异常。 如果我通过管理控制台手动将war文件部署到服务器,一切正常。因此,应用程序本身或Glassfish配置中似乎没有错误:
SCHWERWIEGEND: Could not resolve a persistence unit corresponding to the persistence-context-ref-name [com.sun.ejb.containers.TimerBean/em] in the scope of the module called [MyCMS]. Please verify your application.
java.lang.RuntimeException: Could not resolve a persistence unit corresponding to the persistence-context-ref-name [com.sun.ejb.containers.TimerBean/em] in the scope of the module called [MyCMS]. Please verify your application.
at com.sun.enterprise.deployment.BundleDescriptor.findReferencedPUViaEMRef(BundleDescriptor.java:693)
at com.sun.enterprise.deployment.BundleDescriptor.findReferencedPUsViaPCRefs(BundleDescriptor.java:681)
at com.sun.enterprise.deployment.WebBundleDescriptor.findReferencedPUs(WebBundleDescriptor.java:1056)
at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:184)
at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:166)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:870)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:410)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:370)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:355)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1067)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1247)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:465)
at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:222)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:168)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:117)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:234)
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:619)
有没有人遇到过与Eclipse类似的问题并找到了解决方案呢?
干杯, 费边
答案 0 :(得分:1)
谢谢Ludo的帮助!我解决了我的问题:由于某种原因,eclipse工作区到glassfist eclipseApp文件夹的映射不正确。更新eclipse导致整个Maven依赖库被部署。由于derby.jar [test]也被部署到glassfish,我得到了这个奇怪的bug。我不知道这一切是如何发生的以及为什么这是由更新eclipse引起的...无论如何我通过添加以下行属性>解决了这个问题。部署程序集:/ target / myapp / WEB-INF / lib - > WEB-INF / lib中
答案 1 :(得分:1)
我将应用程序从JBoss 6-M2移植到Glassfish 3.1.1时遇到此错误。 persistence.xml文件存档在 META-INF基目录下的ear文件中。 JBoss没有找到它的问题,但Glassfish对此位置存在范围问题。解决方案是重建存档,以便persistence.xml将存储在特定jar的META-INF目录中。
答案 2 :(得分:0)
是Web应用程序还是Full EAR应用程序? 我猜你用展开的目录部署了。 GF服务器属性中有一个新选项,即dialo deploy archives而不是展开的目录。 你能试试吗?这将告诉Eclipse包装方面是否存在问题。 似乎可能没有正确设置或部署persistence.xml文件?
您还可以检查域目录中服务器使用的展开目录内容。 检查eclipsApps子目录。