2014-09-20 29 views
3

我想部署我JAVA EE7應用程序。我有EntityManagerProducer作爲__FIRST_PHASE__缺少[jboss.naming.context.java.app.earth.env.EarthDS]「]}?

import javax.ejb.Singleton; 
import javax.ejb.Startup; 
import javax.enterprise.inject.Produces; 
import javax.persistence.EntityManager; 
import javax.persistence.PersistenceUnit; 

@Startup 
@Singleton 
public class PersistenceEntityManagerProducer { 
    @PersistenceUnit(unitName = "earth") 
    private EntityManager entityManager; 

    @Produces 
    @PersistenceEntityManager 
    public EntityManager getEntityManager() { 
     return entityManager; 
    } 
} 

和我CrudService作爲

import javax.annotation.Nonnull; 
import javax.annotation.Nullable; 
import javax.ejb.Stateless; 
import javax.ejb.TransactionAttribute; 
import javax.ejb.TransactionAttributeType; 
import javax.inject.Inject; 
import javax.persistence.EntityManager; 

@Stateless 
@TransactionAttribute(TransactionAttributeType.REQUIRED) 
public class CrudService { 
    private EntityManager entityManager; 

    @SuppressWarnings("UnusedDeclaration") 
    public CrudService() { 
    } 

    @Inject 
    public CrudService(@PersistenceEntityManager @Nonnull final EntityManager entityManager) { 
     this.entityManager = entityManager; 
    } 

    @SuppressWarnings("UnusedDeclaration") 
    @Nonnull 
    public EntityManager getEntityManager() { 
     return entityManager; 
    } 

    @Nonnull 
    public <T> T create(@Nonnull final T entity) { 
     entityManager.persist(entity); 
     entityManager.flush(); 
     entityManager.refresh(entity); 
     return entity; 
    } 

    @Nullable 
    public <T> T find(final long id, final Class<T> classType) { 
     return entityManager.find(classType, id); 
    } 

    public <T> void delete(@Nonnull final T entity) { 
     entityManager.remove(entity); 
    } 
} 

persistence.xml看起來像

<?xml version="1.0" encoding="UTF-8"?> 
<persistence 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xmlns="http://java.sun.com/xml/ns/persistence" 
     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd" 
     version="2.0"> 
    <persistence-unit name="earth" transaction-type="JTA"> 
     <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider> 
     <jta-data-source>java:app/env/EarthDS</jta-data-source> 
     <properties> 
      <property name="hibernate.archive.autodetection" value="class"/> 
      <property name="hibernate.id.new_generator_mappings" value="true"/> 
      <property name="javax.persistence.lock.timeout" value="5000"/> 
     </properties> 
    </persistence-unit> 
</persistence> 

我嘗試當我運行我的應用程序部署使用maven-cargo-pluginpom.xml看起來我的應用程序一樣

<?xml version="1.0" encoding="UTF-8"?> 
<project xmlns="http://maven.apache.org/POM/4.0.0" 
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <parent> 
     <artifactId>multi-persistence</artifactId> 
     <groupId>com.learner</groupId> 
     <version>1.0-SNAPSHOT</version> 
    </parent> 
    <modelVersion>4.0.0</modelVersion> 

    <artifactId>integration</artifactId> 

    <dependencies> 
     <dependency> 
      <groupId>com.learner</groupId> 
      <artifactId>services</artifactId> 
      <version>${project.version}</version> 
      <type>war</type> 
     </dependency> 
     <dependency> 
      <groupId>com.h2database</groupId> 
      <artifactId>h2</artifactId> 
      <version>1.4.180</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.derby</groupId> 
      <artifactId>derby</artifactId> 
      <version>10.10.2.0</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.derby</groupId> 
      <artifactId>derbyclient</artifactId> 
      <version>10.11.1.1</version> 
      <scope>test</scope> 
     </dependency> 

    </dependencies> 
    <properties> 
     <maven.cargo.version>1.4.8</maven.cargo.version> 
    </properties> 

    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.carlspring.maven</groupId> 
       <artifactId>derby-maven-plugin</artifactId> 
       <version>1.8</version> 
       <configuration> 
        <port>1527</port> 
       </configuration> 
       <executions> 
        <execution> 
         <id>start-derby</id> 
         <goals> 
          <goal>start</goal> 
         </goals> 
         <phase>pre-integration-test</phase> 
        </execution> 
        <execution> 
         <id>stop-derby</id> 
         <goals> 
          <goal>stop</goal> 
         </goals> 
         <phase>post-integration-test</phase> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>org.codehaus.cargo</groupId> 
       <artifactId>cargo-maven2-plugin</artifactId> 
       <version>${maven.cargo.version}</version> 
       <configuration> 
        <container> 
         <containerId>wildfly8x</containerId> 
         <dependencies combine.children="append"> 
          <dependency> 
           <groupId>org.apache.derby</groupId> 
           <artifactId>derby</artifactId> 
          </dependency> 
          <dependency> 
           <groupId>org.apache.derby</groupId> 
           <artifactId>derbyclient</artifactId> 
          </dependency> 
         </dependencies> 
        </container> 
        <configuration> 
         <properties> 
          <cargo.servlet.port>9090</cargo.servlet.port> 
          <properties> 
           <cargo.datasource.datasource.derby> 
            cargo.datasource.driver=org.apache.derby.jdbc.ClientDriver| 
            cargo.datasource.url=jdbc:derby://localhost:1527/earth;create=true| 
            cargo.datasource.jndi=app/env/EarthDS| 
            cargo.datasource.username=APP| 
            cargo.datasource.password=nonemptypassword 
           </cargo.datasource.datasource.derby> 
          </properties> 
          <!--<properties> 
           <cargo.datasource.datasource.h2> 
            cargo.datasource.driver=org.h2.jdbcx.JdbcDataSource| 
            cargo.datasource.url=jdbc:h2:earth| 
            cargo.datasource.jndi=jdbc/EarthDS| 
            cargo.datasource.username=sa| 
            cargo.datasource.password=sa 
           </cargo.datasource.datasource.h2> 
          </properties>--> 
         </properties> 
        </configuration> 
        <deployables> 
         <deployable> 
          <groupId>com.learner</groupId> 
          <artifactId>services</artifactId> 
          <type>war</type> 
          <properties> 
           <context>earth</context> 
          </properties> 
         </deployable> 
        </deployables> 
       </configuration> 
       <executions> 
        <execution> 
         <id>start-container</id> 
         <goals> 
          <goal>start</goal> 
         </goals> 
         <phase>pre-integration-test</phase> 
        </execution> 
        <execution> 
         <id>stop-container</id> 
         <goals> 
          <goal>stop</goal> 
         </goals> 
         <phase>post-integration-test</phase> 
        </execution> 
       </executions> 
      </plugin> 
     </plugins> 
    </build> 

</project> 

,我看到錯誤的

[INFO] ------------------------------------------------------------------------ 
[INFO] Building integration 1.0-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ integration --- 
[INFO] Deleting /Users/harit/Box Sync/code/idea/java-ee-multiple-persistence/integration/target 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ integration --- 
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] skip non existing resourceDirectory /Users/harit/Box Sync/code/idea/java-ee-multiple-persistence/integration/src/main/resources 
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ integration --- 
[INFO] No sources to compile 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ integration --- 
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] skip non existing resourceDirectory /Users/harit/Box Sync/code/idea/java-ee-multiple-persistence/integration/src/test/resources 
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ integration --- 
[INFO] No sources to compile 
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ integration --- 
[INFO] No tests to run. 
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ integration --- 
[WARNING] JAR will be empty - no content was marked for inclusion! 
[INFO] Building jar: /Users/harit/Box Sync/code/idea/java-ee-multiple-persistence/integration/target/integration-1.0-SNAPSHOT.jar 
[INFO] 
[INFO] --- derby-maven-plugin:1.8:start (start-derby) @ integration --- 
[INFO] Initializing Derby server control for localhost/127.0.0.1 
[INFO] Starting the Derby server ... 
Sat Sep 20 09:50:56 PDT 2014 : Apache Derby Network Server - 10.10.1.1 - (1458268) started and ready to accept connections on port 1527 
[INFO] Derby ping-pong: [OK] 
[INFO] 
[INFO] --- cargo-maven2-plugin:1.4.8:start (start-container) @ integration --- 
[INFO] [2.ContainerStartMojo] Resolved container artifact org.codehaus.cargo:cargo-core-container-wildfly:jar:1.4.8 for container wildfly8x 
[INFO] You did not specify a container home nor any installer. CARGO will automatically download your container's binaries from [http://download.jboss.org/wildfly/8.0.0.Final/wildfly-8.0.0.Final.tar.gz]. 
[INFO] [talledLocalContainer] Parsed JBoss version = [8.x] 
[INFO] [talledLocalContainer] WildFly 8.x starting... 
[INFO] [neLocalConfiguration] Configuring JBoss using the [standalone] server configuration 
[INFO] [stalledLocalDeployer] Deploying [/Users/harit/Box Sync/code/idea/java-ee-multiple-persistence/integration/target/cargo/configurations/wildfly8x/tmp/cargo/earth.war] to [/Users/harit/Box Sync/code/idea/java-ee-multiple-persistence/integration/target/cargo/configurations/wildfly8x/deployments]... 
[INFO] [talledLocalContainer] Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=48m; support was removed in 8.0 
[INFO] [talledLocalContainer] Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0 
[INFO] [talledLocalContainer] 09:51:04,293 INFO [org.jboss.modules] (main) JBoss Modules version 1.3.0.Final 
[INFO] [talledLocalContainer] 09:51:04,692 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.0.Final 
[INFO] [talledLocalContainer] 09:51:04,799 INFO [org.jboss.as] (MSC service thread 1-6) JBAS015899: WildFly 8.0.0.Final "WildFly" starting 
[INFO] [talledLocalContainer] 09:51:06,727 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http) 
[INFO] [talledLocalContainer] 09:51:06,769 INFO [org.xnio] (MSC service thread 1-2) XNIO version 3.2.0.Final 
[INFO] [talledLocalContainer] 09:51:06,785 INFO [org.xnio.nio] (MSC service thread 1-2) XNIO NIO Implementation Version 3.2.0.Final 
[INFO] [talledLocalContainer] 09:51:06,940 INFO [org.jboss.remoting] (MSC service thread 1-2) JBoss Remoting version 4.0.0.Final 
[INFO] [talledLocalContainer] 09:51:07,008 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 33) JBAS010280: Activating Infinispan subsystem. 
[INFO] [talledLocalContainer] 09:51:07,031 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 28) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3) 
[INFO] [talledLocalContainer] 09:51:07,035 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 39) JBAS012615: Activated the following JSF Implementations: [main] 
[INFO] [talledLocalContainer] 09:51:07,039 INFO [org.jboss.as.security] (ServerService Thread Pool -- 46) JBAS013171: Activating Security Subsystem 
[INFO] [talledLocalContainer] 09:51:07,086 INFO [org.jboss.as.security] (MSC service thread 1-1) JBAS013170: Current PicketBox version=4.0.20.Final 
[INFO] [talledLocalContainer] 09:51:07,128 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 41) JBAS011800: Activating Naming Subsystem 
[INFO] [talledLocalContainer] 09:51:07,301 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 50) JBAS015537: Activating WebServices Extension 
[INFO] [talledLocalContainer] 09:51:07,303 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) JBAS017502: Undertow 1.0.0.Final starting 
[INFO] [talledLocalContainer] 09:51:07,305 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 49) JBAS017502: Undertow 1.0.0.Final starting 
[INFO] [talledLocalContainer] 09:51:07,385 INFO [org.jboss.as.connector.logging] (MSC service thread 1-5) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.3.Final) 
[INFO] [talledLocalContainer] 09:51:07,419 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) JBAS010417: Started Driver service with driver-name = h2 
[INFO] [talledLocalContainer] 09:51:07,634 INFO [org.jboss.as.naming] (MSC service thread 1-4) JBAS011802: Starting Naming Service 
[INFO] [talledLocalContainer] 09:51:07,650 INFO [org.jboss.as.mail.extension] (MSC service thread 1-5) JBAS015400: Bound mail session [java:jboss/mail/Default] 
[INFO] [talledLocalContainer] 09:51:07,927 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 49) JBAS017527: Creating file handler for path /Users/harit/Box Sync/code/idea/java-ee-multiple-persistence/integration/target/cargo/installs/wildfly-8.0.0.Final/wildfly-8.0.0.Final/welcome-content 
[INFO] [talledLocalContainer] 09:51:08,262 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) JBAS017525: Started server default-server. 
[INFO] [talledLocalContainer] 09:51:08,323 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) JBAS017531: Host default-host starting 
[INFO] [talledLocalContainer] 09:51:08,673 INFO [org.wildfly.extension.undertow] (MSC service thread 1-4) JBAS017519: Undertow HTTP listener default listening on /0.0.0.0:9090 
[INFO] [talledLocalContainer] 09:51:08,971 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-6) JBAS015012: Started FileSystemDeploymentService for directory /Users/harit/Box Sync/code/idea/java-ee-multiple-persistence/integration/target/cargo/configurations/wildfly8x/deployments 
[INFO] [talledLocalContainer] 09:51:08,981 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) JBAS015876: Starting deployment of "cargocpc.war" (runtime-name: "cargocpc.war") 
[INFO] [talledLocalContainer] 09:51:08,981 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015876: Starting deployment of "earth.war" (runtime-name: "earth.war") 
[INFO] [talledLocalContainer] 09:51:09,256 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-5) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS] 
[INFO] [talledLocalContainer] 09:51:09,710 INFO [org.jboss.ws.common.management] (MSC service thread 1-4) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.3.Final 
[INFO] [talledLocalContainer] 09:51:10,083 INFO [org.jboss.as.jpa] (MSC service thread 1-7) JBAS011401: Read persistence.xml for earth 
[INFO] [talledLocalContainer] 09:51:10,327 INFO [org.wildfly.extension.undertow] (MSC service thread 1-3) JBAS017534: Registered web context: /cargocpc 
[INFO] [talledLocalContainer] 09:51:10,350 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "earth.war")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"earth.war#earth\".__FIRST_PHASE__ is missing [jboss.naming.context.java.app.earth.env.EarthDS]"]} 
[INFO] [talledLocalContainer] 09:51:10,390 INFO [org.jboss.as.server] (ServerService Thread Pool -- 29) JBAS018559: Deployed "earth.war" (runtime-name : "earth.war") 
[INFO] [talledLocalContainer] 09:51:10,391 INFO [org.jboss.as.server] (ServerService Thread Pool -- 29) JBAS018559: Deployed "cargocpc.war" (runtime-name : "cargocpc.war") 
[INFO] [talledLocalContainer] 09:51:10,395 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report 
[INFO] [talledLocalContainer] JBAS014775: New missing/unsatisfied dependencies: 
[INFO] [talledLocalContainer]  service jboss.naming.context.java.app.earth.env.EarthDS (missing) dependents: [service jboss.persistenceunit."earth.war#earth".__FIRST_PHASE__] 
[INFO] [talledLocalContainer] 
[INFO] [talledLocalContainer] WildFly 8.x started on port [9090] 
[INFO] 
[INFO] --- derby-maven-plugin:1.8:stop (stop-derby) @ integration --- 
[INFO] Initializing Derby server control for localhost/127.0.0.1 
[INFO] [talledLocalContainer] 09:51:10,449 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management 
[INFO] [talledLocalContainer] 09:51:10,449 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990 
[INFO] [talledLocalContainer] 09:51:10,450 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: WildFly 8.0.0.Final "WildFly" started (with errors) in 6995ms - Started 262 of 318 services (2 services failed or missing dependencies, 92 services are lazy, passive or on-demand) 
[ERROR] Derby system shutdown. 
Sat Sep 20 09:51:10 PDT 2014 : Apache Derby Network Server - 10.10.1.1 - (1458268) shutdown 
[INFO] [talledLocalContainer] 09:51:10,670 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) JBAS015877: Stopped deployment earth.war (runtime-name: earth.war) in 33ms 
[INFO] [talledLocalContainer] 09:51:10,744 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018558: Undeployed "earth.war" (runtime-name: "earth.war") 
[INFO] [talledLocalContainer] 09:51:10,745 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report 
[INFO] [talledLocalContainer] JBAS014775: New missing/unsatisfied dependencies: 
[INFO] [talledLocalContainer]  service jboss.persistenceunit."earth.war#earth".__FIRST_PHASE__ (missing) dependents: [service jboss.deployment.unit."earth.war".POST_MODULE] 
[INFO] [talledLocalContainer] 
[INFO] Derby has stopped! 
[INFO] 
[INFO] --- cargo-maven2-plugin:1.4.8:stop (stop-container) @ integration --- 
[INFO] [talledLocalContainer] WildFly 8.x is stopping... 
[INFO] [talledLocalContainer] INFO [org.jboss.modules] JBoss Modules version 1.3.0.Final 
[WARNING] [talledLocalContainer] WARN: can't find jboss-cli.xml. Using default configuration values. 
[INFO] [talledLocalContainer] INFO [org.xnio] XNIO version 3.2.0.Final 
[INFO] [talledLocalContainer] INFO [org.xnio.nio] XNIO NIO Implementation Version 3.2.0.Final 
[INFO] [talledLocalContainer] INFO [org.jboss.remoting] JBoss Remoting version 4.0.0.Final 
[INFO] [talledLocalContainer] 09:51:14,555 INFO [org.jboss.as.controller] (management-handler-thread - 3) JBAS014774: Service status report 
[INFO] [talledLocalContainer] JBAS014776: Newly corrected services: 
[INFO] [talledLocalContainer]  service jboss.naming.context.java.app.earth.env.EarthDS (no longer required) 
[INFO] [talledLocalContainer]  service jboss.persistenceunit."earth.war#earth".__FIRST_PHASE__ (no longer required) 
[INFO] [talledLocalContainer] 
[INFO] [talledLocalContainer] 09:51:14,575 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) JBAS017535: Unregistered web context: /cargocpc 
[INFO] [talledLocalContainer] INFO [org.jboss.as.cli.CommandContext] 
[INFO] [talledLocalContainer] 
[INFO] [talledLocalContainer] INFO [org.jboss.as.cli.CommandContext] The connection to the controller has been closed as the result of the shutdown operation. 
[INFO] [talledLocalContainer] The connection to the controller has been closed as the result of the shutdown operation. 
[INFO] [talledLocalContainer] INFO [org.jboss.as.cli.CommandContext] (Although the command prompt will wrongly indicate connection until the next line is entered) 
[INFO] [talledLocalContainer] (Although the command prompt will wrongly indicate connection until the next line is entered) 
[INFO] [talledLocalContainer] ERROR [org.jboss.remoting.remote.connection] JBREM000200: Remote connection failed: java.io.IOException: Connection reset by peer 
[INFO] [talledLocalContainer] 09:51:14,623 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) JBAS017532: Host default-host stopping 
[INFO] [talledLocalContainer] 09:51:14,626 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-8) JBAS010409: Unbound data source [java:jboss/datasources/ExampleDS] 
[INFO] [talledLocalContainer] INFO [org.jboss.as.cli.CommandContext] {"outcome" => "success"} 
[INFO] [talledLocalContainer] {"outcome" => "success"} 
[INFO] [talledLocalContainer] 09:51:14,639 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) JBAS010418: Stopped Driver service with driver-name = h2 
[INFO] [talledLocalContainer] 09:51:14,640 INFO [org.wildfly.extension.undertow] (MSC service thread 1-2) JBAS017521: Undertow HTTP listener default suspending 
[INFO] [talledLocalContainer] 09:51:14,641 INFO [org.wildfly.extension.undertow] (MSC service thread 1-2) JBAS017520: Undertow HTTP listener default stopped, was bound to /0.0.0.0:9090 
[INFO] [talledLocalContainer] 09:51:14,643 INFO [org.wildfly.extension.undertow] (MSC service thread 1-2) JBAS017506: Undertow 1.0.0.Final stopping 
[INFO] [talledLocalContainer] 09:51:14,691 INFO [org.hibernate.validator.internal.util.Version] (MSC service thread 1-3) HV000001: Hibernate Validator 5.0.3.Final 
[INFO] [talledLocalContainer] 09:51:14,768 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment cargocpc.war (runtime-name: cargocpc.war) in 201ms 
[INFO] [talledLocalContainer] 09:51:14,775 INFO [org.jboss.as] (MSC service thread 1-1) JBAS015950: WildFly 8.0.0.Final "WildFly" stopped in 207ms 
[INFO] [talledLocalContainer] 
[INFO] [talledLocalContainer] WildFly 8.x is stopped 
[INFO] 
[INFO] --- maven-install-plugin:2.4:install (default-install) @ integration --- 
[INFO] Installing /Users/harit/Box Sync/code/idea/java-ee-multiple-persistence/integration/target/integration-1.0-SNAPSHOT.jar to /Users/harit/.m2/repository/com/learner/integration/1.0-SNAPSHOT/integration-1.0-SNAPSHOT.jar 
[INFO] Installing /Users/harit/Box Sync/code/idea/java-ee-multiple-persistence/integration/pom.xml to /Users/harit/.m2/repository/com/learner/integration/1.0-SNAPSHOT/integration-1.0-SNAPSHOT.pom 
[INFO] ------------------------------------------------------------------------ 

誰能告訴我什麼是錯?

回答

1

的錯誤信息是很清楚的:

[INFO] [talledLocalContainer] JBAS014775:新的失蹤/不滿意的依賴關係: [INFO] [talledLocalContainer]服務jboss.naming.context.java.app.earth.env .EarthDS(失蹤)家屬:[service jboss.persistenceunit。「earth.war#earth」。 FIRST_PHASE] [

您是否創建了數據源?

+0

可以按照https://developer.jboss.org/message/625062 – 2014-09-21 21:44:41

+0

中所述創建數據源。無論如何這個答案沒有幫助。 – 2016-06-07 17:52:07

0

您可以創建一個數據源通的CLI(命令行界面) 這是我怎麼做我JBOSS_HOME /獨立/配置/ standalone.xml

<subsystem xmlns="urn:jboss:domain:datasources:1.0"> 
     <datasources> 
      <datasource jndi-name="java:jboss/datasources/EarthDS" pool-name="EarthDS" enabled="true" use-ccm="true"> 
       <connection-url>jdbc:oracle:thin:@myhost:1521:MYDB</connection-url> 
       <connection-property name="defaultNChar"> 
        true 
       </connection-property> 
       <driver>ojdbc6.jar</driver> 
       <new-connection-sql>alter session set current_schema=foobar</new-connection-sql> 
       <pool> 
        <min-pool-size>20</min-pool-size> 
        <max-pool-size>300</max-pool-size> 
       </pool> 
       <security> 
        <user-name>username</user-name> 
        <password>passwd</password> 
       </security> 
       <timeout> 
        <idle-timeout-minutes>15</idle-timeout-minutes> 
       </timeout> 
      </datasource> 
      <drivers> 
       <driver name="h2" module="com.h2database.h2"> 
        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class> 
       </driver> 
      </drivers> 
     </datasources> 
    </subsystem> 
1

您需要配置您的數據源中的獨立.xml或在您的項目中創建-ds.xml數據源文件,如Jboss文檔或mastertheboss頁面中所述。 例如:http://www.mastertheboss.com/jboss-server/jboss-datasource/jboss-as-7-deployable-datasources

你需要把到數據源名稱:

的java:

:應用程序/ ENV/EarthDS

,因爲你的persistence.xml定義它

java:app/env/EarthDS

如果更喜歡在standalone.xml中定義數據源。這裏是一個例子:

 <subsystem xmlns="urn:jboss:domain:datasources:2.0"> 
     <datasources> 
      <datasource jndi-name="java:app/env/EarthDS" pool-name="EarthDS" enabled="true" use-java-context="true"> 
       <connection-url>jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE</connection-url> 
       <driver>h2</driver> 
       <security> 
        <user-name>sa</user-name> 
        <password>sa</password> 
       </security> 
      </datasource> 
      <drivers> 
       <driver name="h2" module="com.h2database.h2"> 
        <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class> 
       </driver> 
      </drivers> 
     </datasources> 
    </subsystem> 

注:這個例子是與Jboss AS7/Wildfly兼容。