2014-03-25 32 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)中配置數據源,但忘記點擊「啓用」,同樣的錯誤會發生。 –

相關問題