Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/jpa/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jpa 未引用的persistenceunit init引发DuplicateServiceException:\uuuu FIRST\u PHASE\uuuuu已注册?_Jpa_Wildfly_Persistence.xml_Persistence Unit - Fatal编程技术网

Jpa 未引用的persistenceunit init引发DuplicateServiceException:\uuuu FIRST\u PHASE\uuuuu已注册?

Jpa 未引用的persistenceunit init引发DuplicateServiceException:\uuuu FIRST\u PHASE\uuuuu已注册?,jpa,wildfly,persistence.xml,persistence-unit,Jpa,Wildfly,Persistence.xml,Persistence Unit,我在Wildfly 8.1中部署了多个war和ear。最近,我将一些代码从hibernate迁移到了jar中的jpa中,jar由ear和war共享 yy.ear -> persistence.xml(ds2,ds3,ds4) -> myjpa.jar ->persistence.xml(ds1) xx.war -> myjpa.jar ->persistence.xml(ds1) 现在,yy.ear还有persistence.xml(引用ds

我在Wildfly 8.1中部署了多个war和ear。最近,我将一些代码从hibernate迁移到了jar中的jpa中,jar由ear和war共享

yy.ear
 -> persistence.xml(ds2,ds3,ds4)
 -> myjpa.jar
    ->persistence.xml(ds1)
xx.war
 -> myjpa.jar
    ->persistence.xml(ds1)
现在,yy.ear还有persistence.xml(引用ds2、ds3和ds4),myjpa.jar也有persistence.xml(仅引用ds1)。但是在部署过程中看到的错误是xx.war正在尝试重新初始化ds4。我已经检查了所有的源代码,但在xx.war或myjpa.jar中没有看到对ds4的引用。那么如何修复这个部署错误呢?服务器日志如下

另外,为了添加yy.ear,可以正确部署,但xx.war不能

06:25:28,332 INFO  [org.jboss.as.jpa] (MSC service thread 1-2) JBAS011401: Read persistence.xml for ds1
06:25:28,666 INFO  [org.jboss.as.jpa] (MSC service thread 1-2) JBAS011401: Read persistence.xml for ds2
06:25:28,669 INFO  [org.jboss.as.jpa] (MSC service thread 1-2) JBAS011401: Read persistence.xml for ds3
06:25:28,672 INFO  [org.jboss.as.jpa] (MSC service thread 1-2) JBAS011401: Read persistence.xml for ds4
06:25:28,675 INFO  [org.jboss.as.jpa] (MSC service thread 1-2) JBAS011401: Read persistence.xml for ds2
06:25:28,679 INFO  [org.jboss.as.jpa] (MSC service thread 1-2) JBAS011401: Read persistence.xml for ds3
06:25:28,682 INFO  [org.jboss.as.jpa] (MSC service thread 1-2) JBAS011401: Read persistence.xml for ds4

06:25:29,352 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."xx.war".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."xx.war".FIRST_MODULE_USE: JBAS018733: Failed to process phase FIRST_MODULE_USE of deployment "xx.war"
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.8.0_45]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.8.0_45]
    at java.lang.Thread.run(Unknown Source) [rt.jar:1.8.0_45]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: JBAS011446: Failed to add persistence unit service for ds4
    at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deployPersistenceUnitPhaseOne(PersistenceUnitServiceHandler.java:551)
    at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.addPuService(PersistenceUnitServiceHandler.java:264)
    at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.handleWarDeployment(PersistenceUnitServiceHandler.java:191)
    at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deploy(PersistenceUnitServiceHandler.java:126)
    at org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:52)
    at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
    ... 5 more
Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.persistenceunit."xx.war#ds4".__FIRST_PHASE__ is already registered
    at org.jboss.msc.service.ServiceRegistrationImpl.setInstance(ServiceRegistrationImpl.java:158) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at org.jboss.msc.service.ServiceControllerImpl.startInstallation(ServiceControllerImpl.java:235) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at org.jboss.msc.service.ServiceContainerImpl.install(ServiceContainerImpl.java:767) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:223) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2401) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:223) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2401) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at org.jboss.msc.service.ServiceBuilderImpl.install(ServiceBuilderImpl.java:317) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
    at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deployPersistenceUnitPhaseOne(PersistenceUnitServiceHandler.java:547)
    ... 10 more

问题是具有过时模式的表。一旦删除这些命令,部署将在没有任何错误的情况下完成