我最近将我的应用程序从Hibernate迁移到了Eclipselink。在Hibernate上时,我的JUnit测试运行得非常好,但是在Eclipselink中似乎失败了以下错误跟踪。
[2014-08-20T12:08:22.992+05:30] [com] [ERROR] [] [48.com.homeserv.common.infra.das.orm.eclipselink.EclipseLinkExceptionTranslator] [tid: main] [ecid: 0000KVm8oLUFg400jzwkno1Jx49V000001,0] Inside method translate[[
Local Exception Stack:
Exception [EclipseLink-30005] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException
Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@138d107f
Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [homeserv] failed.
Internal Exception: Exception [EclipseLink-7253] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.ValidationException
Exception Description: There is no mapping file called [orm/eclipselink/mappings/pm/ConsumerDetailsDefinition.orm.xml] in classpath for persistence unit named [homeserv].
at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:127)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:107)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:177)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at com.homeserv.common.infra.das.orm.eclipselink.EclipseLinkDataAccessManager.openSession(EclipseLinkDataAccessManager.java:105)
at com.homeserv.app.Interaction.begin(Interaction.java:313)
at com.homeserv.app.Interaction.begin(Interaction.java:221)
at com.homeserv.app.workitem.service.WorkItemAddLogApplicationService.processItem(WorkItemAddLogApplicationService.java:128)
at com.homeserv.junit.workitem.item.ItemLogApplicationServiceJUnit.testAddItemLog(ItemLogApplicationServiceJUnit.java:55)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.EntityManagerSetupException
Exception Description: Predeployment of PersistenceUnit [homeserv] failed.
Internal Exception: Exception [EclipseLink-7253] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.ValidationException
Exception Description: There is no mapping file called [orm/eclipselink/mappings/pm/ConsumerDetailsDefinition.orm.xml] in classpath for persistence unit named [homeserv].
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.createPredeployFailedPersistenceException(EntityManagerSetupImpl.java:1954)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:1945)
at org.eclipse.persistence.internal.jpa.deployment.JPAInitializer.callPredeploy(JPAInitializer.java:98)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:96)
... 31 more
我从错误跟踪中理解的是,找不到文件ConsumerDetailsDefinition.orm.xml,这是正确的。但是,我无法找到指定此文件的'classpath'的位置。我应该在哪里查找这个(不正确的)条目,以便解决PersistenceUnitLoadingException?
我正在使用Eclipse Indigo,JDK 1.6.0_29,Ubuntu 64位操作系统。
答案 0 :(得分:0)
此问题已得到解决。我这是一个愚蠢的错误。我的新工作区引用了旧工作区中的配置文件夹,其中指定了旧版本的映射文件[orm/eclipselink/cfgs/pm-maps.orm.xml]
。当我更正JUnit测试运行配置的参数中的配置文件夹路径时,所有内容都立即被整理出来。
自我注意: