Question

Here's my error

ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 2) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "test.war")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"test.war#primary\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jboss.datasources.KitchensinkQuickstartTestDS]"]}                                                                                                       
ERROR [org.jboss.as.server] (management-handler-thread - 2) JBAS015870: Deploy of deployment "test.war" was rolled back with the following failure message: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"test.war#primary\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jboss.datasources.KitchensinkQuickstartTestDS]"]}  

and the caused by portion of the stack trace

Caused by: java.lang.Exception: "JBAS014807: Management resource '[(\"deployment\" => \"test.war\")]' not found"
    at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.getActionResult(ServerDeploymentPlanResultFuture.java:134) ~[wildfly-controller-client-8.0.0.Final.jar:8.0.0.Final]
    at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.getResultFromNode(ServerDeploymentPlanResultFuture.java:123) ~[wildfly-controller-client-8.0.0.Final.jar:8.0.0.Final]
    at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.get(ServerDeploymentPlanResultFuture.java:85) ~[wildfly-controller-client-8.0.0.Final.jar:8.0.0.Final]
    at org.jboss.as.controller.client.helpers.standalone.impl.ServerDeploymentPlanResultFuture.get(ServerDeploymentPlanResultFuture.java:42) ~[wildfly-controller-client-8.0.0.Final.jar:8.0.0.Final]

and relevant log output

2014-03-25 00:06:26,543 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 3) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "test.war")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"test.war#primary\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jboss.datasources.KitchensinkQuickstartTestDS]"]}
2014-03-25 00:06:26,544 ERROR [org.jboss.as.server] (management-handler-thread - 3) JBAS015870: Deploy of deployment "test.war" was rolled back with the following failure message: {"JBAS014771: Services with missing/unavailable dependencies" => jboss.persistenceunit.\"test.war#primary\".__FIRST_PHASE__ is missing [jboss.naming.context.java.jboss.datasources.KitchensinkQuickstartTestDS]"]}
2014-03-25 00:06:26,551 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015877: Stopped deployment test.war (runtime-name: test.war) in 7ms
2014-03-25 00:06:26,552 INFO  [org.jboss.as.controller] (management-handler-thread - 3) JBAS014774: Service status report
JBAS014775:    New missing/unsatisfied dependencies:
      service jboss.naming.context.java.jboss.datasources.KitchensinkQuickstartTestDS (missing) dependents: [service jboss.persistenceunit."test.war#primary".__FIRST_PHASE__]
      service jboss.persistenceunit."test.war#primary".__FIRST_PHASE__ (missing) dependents: [service jboss.deployment.unit."test.war".POST_MODULE]

2014-03-25 00:06:26,558 DEBUG [org.jboss.as.controller.management-operation] (management-handler-thread - 4) JBAS014616: Operation ("undeploy") failed - address: ([("deployment" => "test.war")]) - failure description: "JBAS014807: Management resource '[(\"deployment\" => \"test.war\")]' not found"
2014-03-25 00:06:26,586 DEBUG [org.jboss.as.controller.management-operation] (management-handler-thread - 2) Entered VERIFY stage; waiting for service container to settle
2014-03-25 00:06:26,595 INFO  [org.jboss.as.controller] (management-handler-thread - 2) JBAS014774: Service status report
JBAS014776:    Newly corrected services:
      service jboss.naming.context.java.jboss.datasources.KitchensinkQuickstartTestDS (no longer required)
      service jboss.persistenceunit."test.war#primary".__FIRST_PHASE__ (no longer required)

Here's the contents of my Jar

ar = 64668e4f-f815-495a-a612-bc1c9c87b4cc.jar:
/com/
/com/lm/
/com/lm/infrastructure/
/com/lm/infrastructure/Regex.class
/com/lm/infrastructure/SystemServices.class
/com/lm/infrastructure/RegexTest.class
/com/lm/infrastructure/JacksonProducer.class
/com/lm/model/
/com/lm/model/Identifiable.class
/com/lm/model/Page.class
/com/lm/model/Entity.class
/com/lm/model/Buildable.class
/com/lm/model/Wirer.class
/com/lm/model/BaseIdentifierDTO.class
/com/lm/model/Factory.class
/com/lm/model/EntityBuilder.class
/com/lm/model/Director.class
/com/lm/model/Builder.class
/com/lm/model/Identifier.class
/com/lm/model/Repository.class
/com/lm/test/
/com/lm/test/TestBase.class
/com/lm/test/UnitTest.class
/com/lm/test/RESTCtrlTestBase.class
/com/lm/test/TestUtil.class
/com/lm/activity/
/com/lm/activity/persistence/
/com/lm/activity/persistence/inmemory/
/com/lm/activity/persistence/inmemory/ActivityInventoryMemUnitTest.class
/com/lm/activity/persistence/inmemory/ActivitiesMemUnitTest.class
/com/lm/activity/persistence/inmemory/ActivityInventoryMem.class
/com/lm/activity/persistence/inmemory/ActivitiesMem.class
/com/lm/activity/UnitTestBaseForActivity.class
/com/lm/activity/SimplyDescriptive.class
/com/lm/activity/Activity$Builder.class
/com/lm/activity/ActivityId.class
/com/lm/activity/ActivitiesRepo.class
/com/lm/activity/FactoryBuilderActivity.class
/com/lm/activity/ActivityInventory.class
/com/lm/activity/Activity$DTO.class
/com/lm/activity/Activity.class
/com/lm/activity/ActivityCompleted.class
/com/lm/activity/Activity_.class
/com/lm/activity/ActivityId$DTO.class
/com/lm/activity/ToDoUnitTest.class
/com/lm/activity/ActivityUnitTest.class
/com/lm/activity/TestBaseForActivity.class
/com/lm/activity/ActivityEvent.class
/com/lm/activity/BuilderActivityPermaURI.class
/com/lm/activity/Descriptive.class
/com/lm/activity/ToDo.class
/com/lm/activity/DomainEvent.class
/com/lm/activity/Individual.class
/META-INF/
/META-INF/logback.xml
/META-INF/test-ds.xml
/META-INF/beans.xml
/META-INF/persistence.xml

here's my persistence.xml

<?xml version="1.0" encoding="UTF-8"?>
<persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
             version="2.1">
<persistence-unit name="primary">
    <jta-data-source>java:jboss/datasources/KitchensinkQuickstartTestDS</jta-data-source>
    <exclude-unlisted-classes>false</exclude-unlisted-classes>
    <properties>
        <!-- Properties for Hibernate -->
        <property name="hibernate.hbm2ddl.auto" value="create-drop" />
        <property name="hibernate.show_sql" value="false" />
    </properties>
</persistence-unit>
</persistence>

test-ds.xml

<?xml version="1.0" encoding="UTF-8"?>
<!-- This is an unmanaged datasource. It should be used for proofs of concept 
   or testing only. It uses H2, an in memory database that ships with JBoss 
   AS. -->
<datasources xmlns="http://www.jboss.org/ironjacamar/schema"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
   <!-- The datasource is bound into JNDI at this location. We reference 
      this in META-INF/test-persistence.xml -->
   <datasource jndi-name="java:jboss/datasources/KitchensinkQuickstartTestDS"
      pool-name="kitchensink-quickstart-test" enabled="true"
      use-java-context="true">
       <connection-url>jdbc:h2:mem:kitchensink-quickstart-test</connection-url>
      <driver>h2</driver>
      <security>
         <user-name>sa</user-name>
         <password>sa</password>
      </security>
   </datasource>
</datasources>

SystemServices class

public class SystemServices {

    @SuppressWarnings( "unused" )
    @Produces
    @PersistenceContext
    private EntityManager em;

    @Produces
    public Logger prLogger( InjectionPoint ip ) {
        return LoggerFactory.getLogger(
                ip.getMember().getDeclaringClass().getName()
        );
    }
}

I don't have any entities yet that have any annotations, so I'd think that it should be able to produce the EntityManager without it causing problems.

Was it helpful?

Solution

The error says that jboss is missing your datasource. Which JBoss/Wildfly version are you using?

Please check first whether JBoss can work with your datasource using f.i. the web console (localhost:9090/console -> Profile -> Datasources).

You can also configure your datasource in standalone.xml but whether this is an appropriate approach or not depends on your setup but I would prefer the standalone.xml approach.

I thought the *-ds.xml datasource configuration file has to be deployed separately, not with the jar. Please have a look here for datasource configurations. I think this could cause your problem since JBoss parses the persistence.xml before deploying the datasource definition and failing at the Persistence manager initialization.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top