JBoss EAP 7.1 Deployment Failed : WFLYCTL0013: Operation ("deploy") failed

23.9k views Asked by At

My Project is war deployment.

XXX.war

For my project there is a datasource (ds) that is installed in jboss.

Also XXX.war has maven dependency on a xxx-domain.jar ,which deals with hibernate/persistence configurations.

Here is my persistence.xml

<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>

This is 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>

This 2 configurations is present in xxx-domain.jar.

When I was trying to deploy it using jboss-as:deploy . It's giving me the following error

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"]

Could somebody please help me to figure out what is the issue ??

2

There are 2 answers

2
Marinos An On BEST ANSWER

Jboss EAP 7.1 Comes with a hibernate version version > 4.3.

If you check this link: https://docs.jboss.org/author/display/WFLY10/JPA+Reference+Guide#JPAReferenceGuide-UpdateyourPersistence.xmlforHibernate5.0 it says that instead of using:

<provider>org.hibernate.ejb.HibernatePersistence</provider>

in your persistence.xml you should use:

<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>.

Provided of course that you are using the container's hibernate version.

0
egorlitvinenko On

It is known CDI problem in Jboss servers. You don't need both files, but if you do, try add this property in persistence.xml:

hibernate.ejb.cfgfile

with path to hibernate.cfg.xml and delete jta-data-source. Or try to set property

hibernate.temp.use_jdbc_metadata_defaults

to false.

UPDATE

I found an issue too.