2014-03-25 41 views
1

这里是我的错误生产的EntityManager抛出__FIRST_PHASE__缺少

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

和造成堆栈跟踪

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] 

和相关日志输出

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) 

下面的部分是内容我的罐子

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 

这里是我的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

public class SystemServices { 

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

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

我没有任何的实体尚未有任何注释,所以我认为,它应该能够生产EntityManager没有它会导致问题。

回答

3

错误表示jboss缺少数据源。你正在使用哪个JBoss/Wildfly版本?

请检查JBoss是否可以使用f.i处理您的数据源。 Web控制台(localhost:9090/console - > Profile - > Datasources)。

您也可以在standalone.xml中配置您的数据源,但是否这是一种合适的方法取决于您的设置,但我更喜欢standalone.xml方法。

我以为* -ds.xml数据源配置文件必须单独部署,而不是使用jar。请查看here了解数据源配置。我认为这可能会导致你的问题,因为JBoss在部署数据源定义之前解析persistence.xml,并在Persistence manager初始化失败。

+0

wildfly 8 CR1(最后的错误导致我无法使用它)。 kitchensink应用程序似乎表示可以将数据源作为jar的一部分进行部署? (现在阅读文档) – xenoterracide

+0

“从WildFly 8开始,您可以部署-ds.xml文件” – xenoterracide

+0

如果在Web控制台(localhost:9090/console - > Profile - > Datasources)中配置数据源,但忘记点击“启用”,同样的错误会发生。 –

相关问题