JBoss EAP 7.1部署失败:WFLYCTL0013:操作(“部署”)失败

时间:2017-08-30 15:18:35

标签: java hibernate persistence jta jboss-eap-7

我的项目是战争部署。

  

XXX.war

对于我的项目,有一个安装在jboss中的数据源(ds)。

同样xxx-domain.jarpersistence.xml的maven依赖,它处理hibernate / persistence配置。

这是我的<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"> <persistence-unit name="primary" transaction-type="JTA"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <jta-data-source>java:/xxxDS</jta-data-source> <exclude-unlisted-classes>false</exclude-unlisted-classes> <properties> <property name="hibernate.show_sql" value="true" /> <property name="hibernate.session_factory_name" value="XXXSessionFactory"/> <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/> <property name="hibernate.transaction.jta.platform" value="org.hibernate.service.jta.platform.internal.JBossStandAloneJtaPlatform" /> </properties> </persistence-unit> </persistence>

hibernate.cfg.xml

这是<?xml version='1.0' encoding='utf-8'?> <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory name="java:jboss/XXXSessionFactory"> <property name="connection.datasource">java:xxxDS</property> <property name="show_sql">false</property> <property name="dialect">org.hibernate.dialect.Oracle9Dialect</property> <property name="current_session_context_class">thread</property> <mapping resource="com/xxx/model/XXXModel.hbm.xml"/> </session-factory> </hibernate-configuration>

xxx-domain.jar

jboss-as:deploy中有2个配置。

当我尝试使用15:58:22,288 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deployment.unit."XXX.war".FIRST_MODULE_USE: org.jboss.msc.service.StartException in service jboss.deployment.unit."XXX.war".FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment "XXX.war" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:172) at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:2032) at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1955) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYJPA0038: Failed to add persistence unit service for primary at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deployPersistenceUnitPhaseOne(PersistenceUnitServiceHandler.java:558) at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.addPuService(PersistenceUnitServiceHandler.java:279) at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.handleWarDeployment(PersistenceUnitServiceHandler.java:206) at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deploy(PersistenceUnitServiceHandler.java:134) at org.jboss.as.jpa.processor.PersistenceBeginInstallProcessor.deploy(PersistenceBeginInstallProcessor.java:52) at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:165) ... 5 more Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.persistenceunit."XXX.war#primary".__FIRST_PHASE__ is already registered at org.jboss.msc.service.ServiceRegistrationImpl.setInstance(ServiceRegistrationImpl.java:158) at org.jboss.msc.service.ServiceControllerImpl.startInstallation(ServiceControllerImpl.java:235) at org.jboss.msc.service.ServiceContainerImpl.install(ServiceContainerImpl.java:768) at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:223) at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2555) at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:223) at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2555) at org.jboss.msc.service.ServiceBuilderImpl.install(ServiceBuilderImpl.java:317) at org.jboss.as.jpa.processor.PersistenceUnitServiceHandler.deployPersistenceUnitPhaseOne(PersistenceUnitServiceHandler.java:554) ... 10 more 15:58:22,292 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 23) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "XXX.war")]) - failure description: { "WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"XXX.war\".FIRST_MODULE_USE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"XXX.war\".FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment \"XXX.war\" Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYJPA0038: Failed to add persistence unit service for primary Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.persistenceunit.\"XXX.war#primary\".__FIRST_PHASE__ is already registered"}, "WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"XXX.war\".FIRST_MODULE_USE"] } 15:58:22,293 ERROR [org.jboss.as.server] (management-handler-thread - 23) WFLYSRV0021: Deploy of deployment "XXX.war" was rolled back with the following failure message: { "WFLYCTL0080: Failed services" => {"jboss.deployment.unit.\"XXX.war\".FIRST_MODULE_USE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"XXX.war\".FIRST_MODULE_USE: WFLYSRV0153: Failed to process phase FIRST_MODULE_USE of deployment \"XXX.war\" Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: WFLYJPA0038: Failed to add persistence unit service for primary Caused by: org.jboss.msc.service.DuplicateServiceException: Service jboss.persistenceunit.\"XXX.war#primary\".__FIRST_PHASE__ is already registered"}, "WFLYCTL0412: Required services that are not installed:" => ["jboss.deployment.unit.\"XXX.war\".FIRST_MODULE_USE"] 部署它时。它给了我以下错误

mvn

有人可以帮我弄清问题是什么?

2 个答案:

答案 0 :(得分:2)

Jboss EAP 7.1附带一个休眠版本版本&gt; 4.3。

如果您查看此链接:https://docs.jboss.org/author/display/WFLY10/JPA+Reference+Guide#JPAReferenceGuide-UpdateyourPersistence.xmlforHibernate5.0它表示不使用:

$subquery = $this->getEntityManager() ->createQueryBuilder() ->select(' mr.name as name, SUM(HOUR(TIMEDIFF(m.end, m.start))) as hours, SUM(HOUR(TIMEDIFF(m.end, m.start))) * users.costHour as cost') ->from('AppBundle:Meeting','m') ->join('m.meetingRooms', 'mr') ->join('m.participantUsers', 'ma') ->join('ma.user_id', 'users') ->join('users.groups', 'gu') ->where('m.cancel = false') ->andWhere('m.isMaster=false'); $totalHoursAndCost = $this->getEntityManager()->createQueryBuilder() ->select('SUM(hours) as y, SUM(cost) as totalCost') ->from( '## $subquery here ##') ->groupBy('name')->getQuery() ->getResult();

你应该使用<provider>org.hibernate.ejb.HibernatePersistence</provider>中的

persistence.xml

当然,您使用的是容器的休眠版本。

答案 1 :(得分:0)

在Jboss服务器中已知CDI问题。 您不需要这两个文件,但如果这样做,请尝试在persistence.xml中添加此属性:

hibernate.ejb.cfgfile

带有hibernate.cfg.xml的路径并删除jta-data-source。 或者尝试设置属性

hibernate.temp.use_jdbc_metadata_defaults

为假。

更新

我也发现了issue