I am trying to deploy my JAVA EE7 application. I have EntityManagerProducer as
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;
}
}
and my CrudService as
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);
}
}
My persistence.xml looks like
<?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>
I try to deploy my application using maven-cargo-plugin and pom.xml looks like
<?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>
When I run my application, I see error as
[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] ------------------------------------------------------------------------
Can someone tell me what is wrong ?
You needs to configure your datasource in your standalone.xml or create a -ds.xml datasource file in your project like explains in Jboss documentation or in mastertheboss page.
For example: http://www.mastertheboss.com/jboss-server/jboss-datasource/jboss-as-7-deployable-datasources
You need to put to the datasource the name:
java:app/env/EarthDS
because you defined it on persistence.xml:
java:app/env/EarthDS
If prefers define your datasource in your standalone.xml. Here is an example:
<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>
Note: This examples are compatibles with Jboss AS7/Wildfly .
You can create a datasource thru the CLI (command line interface)
This is how I do it my JBOSS_HOME/standalone/configuration/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>
The error message is pretty clear:
[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]
[
Do you have the data source created ?
Related
Getting server log error - earlier
13:31:25,905 INFO [org.jboss.as.jpa] (MSC service thread 1-3) JBAS011401: Read persistence.xml for testJpaUnit
13:31:27,731 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "test.war")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"test.war#testJpaUnit\".__FIRST_PHASE__ is missing [jboss.naming.context.java.testDataSource]"]}
update after changes
You will come across deployment.internal.ear, which is another package needed for this app to work and is getting deployed properly.
11:30:08,028 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) JBAS010400: Bound data source [java:/testDataSource]
11:30:31,216 INFO [org.jboss.as.jpa] (MSC service thread 1-6) JBAS011401: Read persistence.xml for testJpaUnit
11:30:33,921 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 50) JBAS011409: Starting Persistence Unit (phase 1 of 2) Service 'test.war#testJpaUnit'
11:30:33,966 INFO [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 50) HHH000204: Processing PersistenceUnitInfo [
name: testJpaUnit
...]
11:30:34,313 INFO [org.hibernate.Version] (ServerService Thread Pool -- 50) HHH000412: Hibernate Core {4.3.7.Final}
11:30:34,314 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 50) HHH000206: hibernate.properties not found
11:30:34,318 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 50) HHH000021: Bytecode provider name : javassist
11:30:54,858 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.deployment.unit."test.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."test.war".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment "test.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.8.0_144]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.8.0_144]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.8.0_144]
Caused by: java.lang.RuntimeException: JBAS018757: Error getting reflective information for class com.service.ServiceBeanImpl with ClassLoader ModuleClassLoader for Module "deployment.internal.ear:main" from Service Module Loader
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:72) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
at org.jboss.as.ee.metadata.MethodAnnotationAggregator.runtimeAnnotationInformation(MethodAnnotationAggregator.java:58)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.handleAnnotations(InterceptorAnnotationProcessor.java:107)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.processComponentConfig(InterceptorAnnotationProcessor.java:92)
at org.jboss.as.ee.component.deployers.InterceptorAnnotationProcessor.deploy(InterceptorAnnotationProcessor.java:77)
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:159) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
... 5 more
Caused by: java.lang.NoClassDefFoundError: org/hibernate/StatelessSession
at java.lang.Class.getDeclaredMethods0(Native Method) [rt.jar:1.8.0_144]
at java.lang.Class.privateGetDeclaredMethods(Unknown Source) [rt.jar:1.8.0_144]
at java.lang.Class.getDeclaredMethods(Unknown Source) [rt.jar:1.8.0_144]
at org.jboss.as.server.deployment.reflect.ClassReflectionIndex.<init>(ClassReflectionIndex.java:65) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
at org.jboss.as.server.deployment.reflect.DeploymentReflectionIndex.getClassIndex(DeploymentReflectionIndex.java:68) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
... 10 more
Caused by: java.lang.ClassNotFoundException: org.hibernate.StatelessSession from [Module "deployment.internal.ear:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.3.Final]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.3.Final]
... 15 more
11:30:54,904 ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "test.war")]) - failure description: {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"test.war\".POST_MODULE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"test.war\".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment \"test.war\"
Caused by: java.lang.RuntimeException: JBAS018757: Error getting reflective information for class com.service.ServiceBeanImpl with ClassLoader ModuleClassLoader for Module \"deployment.internal.ear:main\" from Service Module Loader
Caused by: java.lang.NoClassDefFoundError: org/hibernate/StatelessSession
Caused by: java.lang.ClassNotFoundException: org.hibernate.StatelessSession from [Module \"deployment.internal.ear:main\" from Service Module Loader]"}}
11:30:55,022 INFO [org.jboss.as.server] (ServerService Thread Pool -- 28) JBAS018559: Deployed "test.war" (runtime-name : "test.war")
11:30:55,022 INFO [org.jboss.as.server] (ServerService Thread Pool -- 28) JBAS018559: Deployed "internal.ear" (runtime-name : "internal.ear")
11:30:55,027 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.deployment.unit."test.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."test.war".POST_MODULE: JBAS018733: Failed to process phase POST_MODULE of deployment "test.war"
11:30:55,239 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
11:30:55,239 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
11:30:55,239 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: WildFly 8.2.0.Final "Tweek" started (with errors) in 609354ms - Started 237 of 294 services (1 services failed or missing dependencies, 92 services are lazy, passive or on-demand)
11:30:56,582 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 2) JBAS011410: Stopping Persistence Unit (phase 1 of 2) Service 'test.war#testJpaUnit'
11:31:03,510 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment test.war (runtime-name: test.war) in 6930ms
11:31:03,715 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018558: Undeployed "test.war" (runtime-name: "test.war")
11:31:03,716 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.deployment.unit."test.war".POST_MODULE
I have tried changing hibernate entitymanager jar from 4.2 -> 4.3 and searched stackoverflow similar answers and jboss documentations. But not helped.
persistence.xml - updated
<?xml version="1.0" encoding="UTF-8"?>
<persistence 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"
version="2.0">
<!-- A JPA Persistence Unit -->
<persistence-unit name="testJpaUnit">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<non-jta-data-source>java:/testDataSource</non-jta-data-source>
<!-- JPA entities must be registered here -->
<class>com.test.DemoClass</class>
<class>com.test.DummyClass</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />
<property name="hibernate.hbm2ddl.auto" value="none"/>
<property name="hibernate.show_sql" value="false" />
</properties>
</persistence-unit>
</persistence>
Please help so that I can deploy the web app to the wildfly server.
Update
changes to standalone.xml
<subsystem xmlns="urn:jboss:domain:datasources:2.0">
<datasources>
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool-name="ExampleDS" 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>
<datasource jta="false" jndi-name="java:/testDataSource" pool-name="testDataSource" enabled="true" use-java-context="true">
<connection-url>jdbc:mysql://localhost:3306/test</connection-url>
<driver>com.mysql.jdbc.Driver</driver>
<security>
<user-name>root</user-name>
<password>root</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>
PS I haven't share logs which is irrelevant and and some name of Classes is changed due IP. like com.service.ServiceBeanImpl
According to the database configuration shared by you from standalone.xml, You don't have datasource named testDataSource created on your wildfly server. Create non-jta datasource on your wildfly server with name as testDataSource. Once you create datasource you will be able to deploy your application.
I used Ant+ivy build method to solve the issue. There was directory structure issue in the war created by Wildlfly. Do follow comments above to understand this issue more and solution stages.
Also, Do follow above given link if you want to setup automatic build in eclipse for ant.
Thank you Abhijeet.
I am trying for more than two hours now to fix my maven setup in Eclipse but I am getting from one error to the next and no solution in the intenet worked for me.
Also maven -> update project did not solve the problem.
Also setting java compiler on build path results in no success. Eclipse suggests always to set it back to 1.5 (manually setting 1.7 no success)
I am not sure which entry in my pom.xml causes the error.
I am getting these errors
my pom.xml
`<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">
<modelVersion>4.0.0</modelVersion>
<groupId>org.se.bac</groupId>
<artifactId>Mitarbeiterverwaltung</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- JBoss dependency versions -->
<version.wildfly.maven.plugin>1.0.2.Final</version.wildfly.maven.plugin>
<version.jboss.spec.javaee.7.0>1.0.0.Final</version.jboss.spec.javaee.7.0>
<version.war.plugin>2.1.1</version.war.plugin>
<!-- maven-compiler-plugin -->
<version.compiler.plugin>3.1</version.compiler.plugin>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
</properties>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>${version.war.plugin}</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${version.compiler.plugin}</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.0.2.Final</version>
<configuration>
<jbossHome>X:\5. Semester\Bac1\wildfly-11.0.0.CR1</jbossHome>
<port>9990</port>
<server-config>standalone.xml</server-config>
</configuration>
<executions>
<!-- Run wildfly and deploy application for integration tests. -->
<execution>
<id>wildfly-run</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
<goal>deploy</goal>
</goals>
</execution>
<!-- Integration test teardown. -->
<execution>
<id>wildfly-shutdown</id>
<phase>post-integration-test</phase>
<goals>
<goal>undeploy</goal>
<goal>shutdown</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.10-SNAPSHOT</version>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<!-- Define the version of JBoss' Java EE 7 APIs we want to import. Any
dependencies from org.jboss.spec will have their version defined by this
BOM -->
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-7.0</artifactId>
<version>${version.jboss.spec.javaee.7.0}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.34</version>
<scope>test</scope>
</dependency>
<!-- Import the CDI API, we use provided scope as the API is included in
JBoss WildFly -->
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- Import the Common Annotations API (JSR-250), we use provided scope
as the API is included in JBoss WildFly -->
<dependency>
<groupId>org.jboss.spec.javax.annotation</groupId>
<artifactId>jboss-annotations-api_1.2_spec</artifactId>
<scope>provided</scope>
</dependency>
<!-- Import the JAX-RS API, we use provided scope as the API is included
in JBoss WildFly -->
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>jaxrs-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- Import the JSON API to build JSON Objects -->
<dependency>
<groupId>org.jboss.spec.javax.json</groupId>
<artifactId>jboss-json-api_1.0_spec</artifactId>
<scope>provided</scope>
</dependency>
<!-- Import the EJB API -->
<dependency>
<groupId>org.jboss.spec.javax.ejb</groupId>
<artifactId>jboss-ejb-api_3.2_spec</artifactId>
<scope>provided</scope>
</dependency>
<!-- Import the JPA API -->
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<scope>provided</scope>
</dependency>
<!-- Import the JSF API, we use provided scope as the API is included in
JBoss WildFly -->
<dependency>
<groupId>org.jboss.spec.javax.faces</groupId>
<artifactId>jboss-jsf-api_2.2_spec</artifactId>
<scope>provided</scope>
</dependency>
<!-- Primefaces -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>6.0</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.9.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.el/javax.el-api -->
<dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>3.0.1-b04</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.11.Final</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
And my settings for the project:
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # Mitarbeiterverwaltung ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # Mitarbeiterverwaltung ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) # Mitarbeiterverwaltung ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # Mitarbeiterverwaltung ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) # Mitarbeiterverwaltung ---
[INFO]
[INFO] --- wildfly-maven-plugin:1.0.2.Final:start (wildfly-run) # Mitarbeiterverwaltung ---
[INFO] JAVA_HOME=C:\Program Files\Java\jdk1.8.0_144\jre
[INFO] JBOSS_HOME=X:\5. Semester\Bac1\wildfly-11.0.0.CR1
[INFO] Server is starting up.
Okt 17, 2017 8:42:00 PM org.xnio.Xnio <clinit>
INFO: XNIO version 3.2.2.Final
Okt 17, 2017 8:42:00 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.2.2.Final
Okt 17, 2017 8:42:00 PM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 4.0.3.Final
20:42:02,670 INFO [org.jboss.as.security] (MSC service thread 1-8) WFLYSEC0001: Current PicketBox version=5.0.2.Final
20:42:02,676 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 48) WFLYJSF0007: Activated the following JSF Implementations: [main]
20:42:02,677 INFO [org.jboss.as.connector] (MSC service thread 1-2) WFLYJCA0009: Starting JCA Subsystem (WildFly/IronJacamar 1.4.6.Final)
20:42:02,680 INFO [org.wildfly.extension.io] (ServerService Thread Pool -- 41) WFLYIO001: Worker 'default' has auto-configured to 16 core threads with 128 task threads based on your 8 available processors
20:42:02,732 INFO [org.jboss.remoting] (MSC service thread 1-6) JBoss Remoting version 5.0.0.Final
20:42:02,737 INFO [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0003: Undertow 1.4.18.Final starting
20:42:02,757 INFO [org.jboss.as.naming] (MSC service thread 1-4) WFLYNAM0003: Starting Naming Service
20:42:02,762 INFO [org.jboss.as.mail.extension] (MSC service thread 1-2) WFLYMAIL0001: Bound mail session [java:jboss/mail/Default]
20:42:02,863 INFO [org.jboss.as.ejb3] (MSC service thread 1-2) WFLYEJB0482: Strict pool mdb-strict-max-pool is using a max instance size of 32 (per class), which is derived from the number of CPUs on this host.
20:42:02,863 INFO [org.jboss.as.ejb3] (MSC service thread 1-3) WFLYEJB0481: Strict pool slsb-strict-max-pool is using a max instance size of 128 (per class), which is derived from thread worker pool sizing.
20:42:02,931 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 59) WFLYUT0014: Creating file handler for path 'X:\5. Semester\Bac1\wildfly-11.0.0.CR1/welcome-content' with options [directory-listing: 'false', follow-symlink: 'false', case-sensitive: 'true', safe-symlink-paths: '[]']
20:42:02,942 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0012: Started server default-server.
20:42:02,945 INFO [org.wildfly.extension.undertow] (MSC service thread 1-7) WFLYUT0018: Host default-host starting
20:42:02,985 INFO [org.wildfly.extension.undertow] (MSC service thread 1-5) WFLYUT0006: Undertow HTTP listener default listening on 127.0.0.1:8080
20:42:03,008 INFO [org.jboss.as.ejb3] (MSC service thread 1-5) WFLYEJB0493: EJB subsystem suspension complete
20:42:03,083 INFO [org.jboss.as.patching] (MSC service thread 1-5) WFLYPAT0050: WildFly Full cumulative patch ID is: base, one-off patches include: none
20:42:03,098 WARN [org.jboss.as.domain.management.security] (MSC service thread 1-7) WFLYDM0111: Keystore X:\5. Semester\Bac1\wildfly-11.0.0.CR1\standalone\configuration\application.keystore not found, it will be auto generated on first use with a self signed certificate for host localhost
20:42:03,100 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-2) WFLYDS0013: Started FileSystemDeploymentService for directory X:\5. Semester\Bac1\wildfly-11.0.0.CR1\standalone\deployments
20:42:03,107 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) WFLYSRV0027: Starting deployment of "mysql-connector-java-5.1.44.zip" (runtime-name: "mysql-connector-java-5.1.44.zip")
20:42:03,108 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) WFLYSRV0027: Starting deployment of "Mitarbeiterverwaltung.war" (runtime-name: "Mitarbeiterverwaltung.war")
20:42:03,108 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0027: Starting deployment of "mysql-connector-java-5.1.44-bin.jar" (runtime-name: "mysql-connector-java-5.1.44-bin.jar")
20:42:03,498 INFO [org.wildfly.extension.undertow] (MSC service thread 1-8) WFLYUT0006: Undertow HTTPS listener https listening on 127.0.0.1:8443
20:42:03,578 INFO [org.jboss.ws.common.management] (MSC service thread 1-8) JBWS022052: Starting JBossWS 5.1.9.Final (Apache CXF 3.1.12)
20:42:03,769 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) WFLYJCA0005: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
20:42:03,773 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-2) WFLYJCA0005: Deploying non-JDBC-compliant driver class com.mysql.fabric.jdbc.FabricMySQLDriver (version 5.1)
20:42:03,776 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) WFLYJCA0018: Started Driver service with driver-name = mysql-connector-java-5.1.44-bin.jar_com.mysql.fabric.jdbc.FabricMySQLDriver_5_1
20:42:03,777 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) WFLYJCA0018: Started Driver service with driver-name = mysql-connector-java-5.1.44-bin.jar_com.mysql.jdbc.Driver_5_1
20:42:03,850 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) WFLYJCA0001: Bound data source [java:/MySqlDS]
20:42:03,924 INFO [org.infinispan.factories.GlobalComponentRegistry] (MSC service thread 1-4) ISPN000128: Infinispan version: Infinispan 'Chakra' 8.2.8.Final
20:42:04,255 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 62) WFLYCLINF0002: Started client-mappings cache from ejb container
20:42:04,480 INFO [org.jboss.as.jpa] (MSC service thread 1-6) WFLYJPA0002: Read persistence.xml for primary
20:42:04,552 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 62) WFLYJPA0010: Starting Persistence Unit (phase 1 of 2) Service 'Mitarbeiterverwaltung.war#primary'
20:42:04,576 INFO [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 62) HHH000204: Processing PersistenceUnitInfo [
name: primary
...]
20:42:05,115 INFO [org.jboss.weld.Version] (MSC service thread 1-8) WELD-000900: 2.4.3 (Final)
20:42:05,288 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 62) WFLYJPA0010: Starting Persistence Unit (phase 2 of 2) Service 'Mitarbeiterverwaltung.war#primary'
20:42:05,565 WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (ServerService Thread Pool -- 62) IJ000407: No lazy enlistment available for MySqlDS
20:42:05,578 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 62) HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
20:42:05,615 INFO [org.hibernate.envers.boot.internal.EnversServiceImpl] (ServerService Thread Pool -- 62) Envers integration enabled? : true
20:42:05,834 INFO [org.hibernate.tuple.PojoInstantiator] (ServerService Thread Pool -- 62) HHH000182: No default (no-argument) constructor for class: org.se.bac.data.model.ProjectEmployee_PK (class must be instantiated by Interceptor)
20:42:05,839 WARN [org.hibernate.mapping.RootClass] (ServerService Thread Pool -- 62) HHH000038: Composite-id class does not override equals(): org.se.bac.data.model.ProjectEmployee_PK
20:42:05,839 WARN [org.hibernate.mapping.RootClass] (ServerService Thread Pool -- 62) HHH000039: Composite-id class does not override hashCode(): org.se.bac.data.model.ProjectEmployee_PK
20:42:06,013 INFO [org.hibernate.tuple.PojoInstantiator] (ServerService Thread Pool -- 62) HHH000182: No default (no-argument) constructor for class: org.se.bac.data.model.ProjectEmployee_PK (class must be instantiated by Interceptor)
20:42:06,254 INFO [org.hibernate.tuple.PojoInstantiator] (ServerService Thread Pool -- 62) HHH000182: No default (no-argument) constructor for class: org.se.bac.data.model.ProjectEmployee_PK (class must be instantiated by Interceptor)
20:42:06,254 INFO [org.hibernate.tuple.PojoInstantiator] (ServerService Thread Pool -- 62) HHH000182: No default (no-argument) constructor for class: org.se.bac.data.model.ProjectEmployee_PK (class must be instantiated by Interceptor)
20:42:07,030 INFO [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 68) RESTEASY002225: Deploying javax.ws.rs.core.Application: class org.se.bac.service.RESTApplication$Proxy$_$$_WeldClientProxy
20:42:07,034 INFO [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 68) RESTEASY002200: Adding class resource org.se.bac.service.ProjectResourceEJB from Application class org.se.bac.service.RESTApplication$Proxy$_$$_WeldClientProxy
20:42:07,034 INFO [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 68) RESTEASY002200: Adding class resource org.se.bac.service.CustomerResourceEJB from Application class org.se.bac.service.RESTApplication$Proxy$_$$_WeldClientProxy
20:42:07,034 INFO [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 68) RESTEASY002200: Adding class resource org.se.bac.service.EmpResourceEJB from Application class org.se.bac.service.RESTApplication$Proxy$_$$_WeldClientProxy
20:42:07,099 INFO [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 68) Mojarra 2.2.13.SP4 für Kontext '/Mitarbeiterverwaltung' wird initialisiert.
20:42:08,049 INFO [org.primefaces.webapp.PostConstructApplicationEventListener] (ServerService Thread Pool -- 68) Running on PrimeFaces 6.0
20:42:08,070 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 68) WFLYUT0021: Registered web context: '/Mitarbeiterverwaltung' for server 'default-server'
20:42:08,076 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0010: Deployed "mysql-connector-java-5.1.44-bin.jar" (runtime-name : "mysql-connector-java-5.1.44-bin.jar")
20:42:08,076 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0010: Deployed "mysql-connector-java-5.1.44.zip" (runtime-name : "mysql-connector-java-5.1.44.zip")
20:42:08,081 INFO [org.jboss.as.server] (ServerService Thread Pool -- 37) WFLYSRV0010: Deployed "Mitarbeiterverwaltung.war" (runtime-name : "Mitarbeiterverwaltung.war")
20:42:08,126 INFO [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
20:42:08,126 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:9990/management
20:42:08,126 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:9990
20:42:08,131 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly Full 11.0.0.CR1 (WildFly Core 3.0.1.Final) started in 7545ms - Started 561 of 789 services (359 services are lazy, passive or on-demand)
[INFO]
[INFO] >>> wildfly-maven-plugin:1.0.2.Final:deploy (wildfly-run) # Mitarbeiterverwaltung >>>
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # Mitarbeiterverwaltung ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # Mitarbeiterverwaltung ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) # Mitarbeiterverwaltung ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # Mitarbeiterverwaltung ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) # Mitarbeiterverwaltung ---
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) # Mitarbeiterverwaltung ---
[INFO] Packaging webapp
[INFO] Assembling webapp [Mitarbeiterverwaltung] in [C:\Users\Florian\git\Mitarbeiterverwaltung\Mitarbeiterverwaltung\target\Mitarbeiterverwaltung]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\Florian\git\Mitarbeiterverwaltung\Mitarbeiterverwaltung\src\main\webapp]
[INFO] Webapp assembled in [149 msecs]
[INFO] Building war: C:\Users\Florian\git\Mitarbeiterverwaltung\Mitarbeiterverwaltung\target\Mitarbeiterverwaltung.war
[WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored
(webxml attribute is missing from war task, or ignoreWebxml attribute is specified as 'true')
[INFO]
[INFO] <<< wildfly-maven-plugin:1.0.2.Final:deploy (wildfly-run) # Mitarbeiterverwaltung <<<
[INFO]
[INFO] --- wildfly-maven-plugin:1.0.2.Final:deploy (wildfly-run) # Mitarbeiterverwaltung ---
20:42:08,818 INFO [org.jboss.as.repository] (management-handler-thread - 1) WFLYDR0001: Content added at location X:\5. Semester\Bac1\wildfly-11.0.0.CR1\standalone\data\content\8a\f5ae904748ce46128a1e81676f9d16e422dac3\content
20:42:08,828 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 68) WFLYUT0022: Unregistered web context: '/Mitarbeiterverwaltung' from server 'default-server'
20:42:08,862 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 28) WFLYJPA0011: Stopping Persistence Unit (phase 2 of 2) Service 'Mitarbeiterverwaltung.war#primary'
20:42:08,866 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 28) WFLYJPA0011: Stopping Persistence Unit (phase 1 of 2) Service 'Mitarbeiterverwaltung.war#primary'
20:42:08,905 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) WFLYSRV0028: Stopped deployment Mitarbeiterverwaltung.war (runtime-name: Mitarbeiterverwaltung.war) in 86ms
20:42:08,910 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0027: Starting deployment of "Mitarbeiterverwaltung.war" (runtime-name: "Mitarbeiterverwaltung.war")
20:42:09,473 INFO [org.jboss.as.jpa] (MSC service thread 1-8) WFLYJPA0002: Read persistence.xml for primary
20:42:09,509 INFO [org.jboss.as.server.deployment] (MSC service thread 1-7) WFLYSRV0028: Stopped deployment Mitarbeiterverwaltung.war (runtime-name: Mitarbeiterverwaltung.war) in 598ms
20:42:09,510 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) WFLYSRV0027: Starting deployment of "Mitarbeiterverwaltung.war" (runtime-name: "Mitarbeiterverwaltung.war")
20:42:09,889 INFO [org.jboss.as.jpa] (MSC service thread 1-3) WFLYJPA0002: Read persistence.xml for primary
20:42:09,928 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 28) WFLYJPA0010: Starting Persistence Unit (phase 1 of 2) Service 'Mitarbeiterverwaltung.war#primary'
20:42:10,143 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 28) WFLYJPA0010: Starting Persistence Unit (phase 2 of 2) Service 'Mitarbeiterverwaltung.war#primary'
20:42:10,143 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 28) HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
20:42:10,155 INFO [org.hibernate.envers.boot.internal.EnversServiceImpl] (ServerService Thread Pool -- 28) Envers integration enabled? : true
20:42:10,176 INFO [org.hibernate.tuple.PojoInstantiator] (ServerService Thread Pool -- 28) HHH000182: No default (no-argument) constructor for class: org.se.bac.data.model.ProjectEmployee_PK (class must be instantiated by Interceptor)
20:42:10,176 WARN [org.hibernate.mapping.RootClass] (ServerService Thread Pool -- 28) HHH000038: Composite-id class does not override equals(): org.se.bac.data.model.ProjectEmployee_PK
20:42:10,177 WARN [org.hibernate.mapping.RootClass] (ServerService Thread Pool -- 28) HHH000039: Composite-id class does not override hashCode(): org.se.bac.data.model.ProjectEmployee_PK
20:42:10,192 INFO [org.hibernate.tuple.PojoInstantiator] (ServerService Thread Pool -- 28) HHH000182: No default (no-argument) constructor for class: org.se.bac.data.model.ProjectEmployee_PK (class must be instantiated by Interceptor)
20:42:10,210 INFO [org.hibernate.tuple.PojoInstantiator] (ServerService Thread Pool -- 28) HHH000182: No default (no-argument) constructor for class: org.se.bac.data.model.ProjectEmployee_PK (class must be instantiated by Interceptor)
20:42:10,210 INFO [org.hibernate.tuple.PojoInstantiator] (ServerService Thread Pool -- 28) HHH000182: No default (no-argument) constructor for class: org.se.bac.data.model.ProjectEmployee_PK (class must be instantiated by Interceptor)
20:42:10,394 INFO [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 27) RESTEASY002225: Deploying javax.ws.rs.core.Application: class org.se.bac.service.RESTApplication$Proxy$_$$_WeldClientProxy
20:42:10,394 INFO [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 27) RESTEASY002200: Adding class resource org.se.bac.service.CustomerResourceEJB from Application class org.se.bac.service.RESTApplication$Proxy$_$$_WeldClientProxy
20:42:10,394 INFO [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 27) RESTEASY002200: Adding class resource org.se.bac.service.ProjectResourceEJB from Application class org.se.bac.service.RESTApplication$Proxy$_$$_WeldClientProxy
20:42:10,394 INFO [org.jboss.resteasy.resteasy_jaxrs.i18n] (ServerService Thread Pool -- 27) RESTEASY002200: Adding class resource org.se.bac.service.EmpResourceEJB from Application class org.se.bac.service.RESTApplication$Proxy$_$$_WeldClientProxy
20:42:10,404 INFO [javax.enterprise.resource.webcontainer.jsf.config] (ServerService Thread Pool -- 27) Mojarra 2.2.13.SP4 für Kontext '/Mitarbeiterverwaltung' wird initialisiert.
20:42:10,994 INFO [org.primefaces.webapp.PostConstructApplicationEventListener] (ServerService Thread Pool -- 27) Running on PrimeFaces 6.0
20:42:10,995 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 27) WFLYUT0021: Registered web context: '/Mitarbeiterverwaltung' for server 'default-server'
20:42:11,053 INFO [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0013: Redeployed "Mitarbeiterverwaltung.war"
20:42:11,053 INFO [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0016: Replaced deployment "Mitarbeiterverwaltung.war" with deployment "Mitarbeiterverwaltung.war"
20:42:11,054 INFO [org.jboss.as.repository] (management-handler-thread - 1) WFLYDR0002: Content removed from location X:\5. Semester\Bac1\wildfly-11.0.0.CR1\standalone\data\content\42\5aae1bfd48b2702b404b259e1baf3eb71b84bf\content
[INFO]
[INFO] --- maven-install-plugin:2.3.1:install (default-install) # Mitarbeiterverwaltung ---
[INFO] Installing C:\Users\Florian\git\Mitarbeiterverwaltung\Mitarbeiterverwaltung\target\Mitarbeiterverwaltung.war to C:\Users\Florian\.m2\repository\org\se\bac\Mitarbeiterverwaltung\0.0.1-SNAPSHOT\Mitarbeiterverwaltung-0.0.1-SNAPSHOT.war
[INFO] Installing C:\Users\Florian\git\Mitarbeiterverwaltung\Mitarbeiterverwaltung\pom.xml to C:\Users\Florian\.m2\repository\org\se\bac\Mitarbeiterverwaltung\0.0.1-SNAPSHOT\Mitarbeiterverwaltung-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.908s
[INFO] Finished at: Tue Oct 17 20:42:11 CEST 2017
[INFO] Final Memory: 16M/210M
[INFO] ------------------------------------------------------------------------
So I use Wildfly 8.2.0.Final
I created my MySQL datasource successfully. Proof: from the admin console , i do "Test connection" and it gives
Successfully connected to database MyAppDS.
the datasource definition in standalone-full.xml :
<datasources>
<datasource jta="true" jndi-name="java:/jdbc/MyAppDS" pool-name="MyAppDS" enabled="true" use-ccm="true">
<connection-url>jdbc:mysql://localhost:3306/myapp</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<driver>mysql</driver>
<security>
<user-name>root</user-name>
</security>
<validation>
<validate-on-match>false</validate-on-match>
<background-validation>false</background-validation>
</validation>
<timeout>
<set-tx-query-timeout>false</set-tx-query-timeout>
<blocking-timeout-millis>0</blocking-timeout-millis>
<idle-timeout-minutes>0</idle-timeout-minutes>
<query-timeout>0</query-timeout>
<use-try-lock>0</use-try-lock>
<allocation-retry>0</allocation-retry>
<allocation-retry-wait-millis>0</allocation-retry-wait-millis>
</timeout>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
</datasource>
<drivers>
<driver name="mysql" module="com.mysql">
<xa-datasource-class>com.mysql.jdbc.Driver</xa-datasource-class>
</driver>
</drivers>
</datasources>
My persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1" 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">
<persistence-unit name="myapp_myapp_war_1.0PU" transaction-type="JTA">
<jta-data-source>java:/jdbc/MyAppDS</jta-data-source>
<class>org.myapp.entity.Place</class>
<class>org.myapp.entity.User</class>
<class>org.myapp.entity.MyCall</class>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
</properties>
</persistence-unit>
</persistence>
The server log before deploying the application shows
15:07:24,550 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) JBAS010400: Bound data source [java:/jdbc/MyAppDS]
And when I debug my application shows the following, the following line appears
15:09:13,175 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "myapp-1.0.war")]) - failure description: {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.naming.context.java.module.\"myapp-1.0\".\"myapp-1.0\".DefaultDataSource is missing [jboss.naming.context.java.jboss.datasources.ExampleDS]"]}
15:09:13,222 INFO [org.jboss.as.server] (DeploymentScanner-threads - 1) JBAS018559: Deployed "myapp-1.0.war" (runtime-name : "myapp-1.0.war")
15:09:13,237 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 1) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.naming.context.java.jboss.datasources.ExampleDS (missing) dependents: [service jboss.naming.context.java.module."myapp-1.0"."myapp-1.0".DefaultDataSource]
15:09:21,177 ERROR [org.jboss.as.controller.management-operation] (management-handler-thread - 2) JBAS014613: Operation ("read-attribute") failed - address: ([
("deployment" => "myapp-1.0.war"),
("subsystem" => "ejb3"),
("stateless-session-bean" => "MyCallFacadeREST")
]) - failure description: "JBAS014508: EJB component for address [
(\"deployment\" => \"myapp-1.0.war\"),
(\"subsystem\" => \"ejb3\"),
(\"stateless-session-bean\" => \"MyCallFacadeREST\")
] is in
state DOWN, must be in state UP"
15:09:23,356 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-7) JBAS010418: Stopped Driver service with driver-name = myapp-1.0.war_com.mysql.jdbc.Driver_5_1
15:09:23,356 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) JBAS010418: Stopped Driver service with driver-name = myapp-1.0.war_com.mysql.fabric.jdbc.FabricMySQLDriver_5_1
15:09:23,356 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 60) JBAS011410: Stopping Persistence Unit (phase 2 of 2) Service 'myapp-1.0.war#myapp_myapp_war_1.0PU'
15:09:23,356 INFO [org.jboss.weld.deployer] (MSC service thread 1-5) JBAS016009: Stopping weld service for deployment myapp-1.0.war
15:09:23,403 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 60) JBAS011410: Stopping Persistence Unit (phase 1 of 2) Service 'myapp-1.0.war#myapp_myapp_war_1.0PU'
15:09:23,434 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015877: Stopped deployment myapp-1.0.war (runtime-name: myapp-1.0.war) in 81ms
Is this happening because the server doesn't find the datasource I am pointing at so it tries to find the default datasource ExampleDS (which I have removed from my standalone-full.xml)
When you removed the ExampleDS datasource, did you also change the reference to it in the default-bindings of the ee subsystem? By default, Wildfly has this entry:
<default-bindings ... datasource="java:jboss/datasources/ExampleDS" ... />
If you don't want to keep the ExampleDS, you can just make your datasource the default, or (if I remember correctly) the default-bindings are optional so they can be removed if necessary.
Here is how my persistence.xml looks like
<?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">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>java:/jdbc/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>
I am deploying the war file using maven-cargo-plugin. As per their documentation they set the datasource with JNDI as
<configuration>
<properties>
<cargo.datasource.datasource.derby>
cargo.datasource.driver=org.apache.derby.jdbc.EmbeddedDriver|
cargo.datasource.url=jdbc:derby:derbyDB;create=true|
cargo.datasource.jndi=jdbc/CargoDS|
cargo.datasource.username=APP|
cargo.datasource.password=nonemptypassword
</cargo.datasource.datasource.derby>
</properties>
</configuration>
Since I am using H2 database, I set it up as
<properties>
<cargo.servlet.port>9090</cargo.servlet.port>
<properties>
<cargo.datasource.datasource>
cargo.datasource.driver=org.h2.Driver|
cargo.datasource.url=jdbc:h2:~/earth;create=true|
cargo.datasource.jndi=jdbc/EarthDS|
cargo.datasource.username=sa|
cargo.datasource.password=
</cargo.datasource.datasource>
</properties>
</properties>
</configuration>
When I run the project, I see error in log as
[INFO] [talledLocalContainer] 09:43:01,335 INFO [org.jboss.as.server.deployment] (MSC service thread 1-12) JBAS015876: Starting deployment of "cargocpc.war" (runtime-name: "cargocpc.war")
[INFO] [talledLocalContainer] 09:43:01,335 INFO [org.jboss.as.server.deployment] (MSC service thread 1-11) JBAS015876: Starting deployment of "earth.war" (runtime-name: "earth.war")
[INFO] [talledLocalContainer] 09:43:01,478 INFO [org.jboss.ws.common.management] (MSC service thread 1-3) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.3.Final
[INFO] [talledLocalContainer] 09:43:01,753 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017534: Registered web context: /cargocpc
[INFO] [talledLocalContainer] 09:43:01,779 INFO [org.jboss.as.jpa] (MSC service thread 1-16) JBAS011401: Read persistence.xml for earth
[INFO] [talledLocalContainer] WildFly 8.x started on port [9090]
[INFO]
[INFO] --- cargo-maven2-plugin:1.4.8:stop (stop-container) # integration ---
[INFO] [talledLocalContainer] 09:43:01,865 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.jdbc.EarthDS]"]}
[INFO] [talledLocalContainer] 09:43:01,898 INFO [org.jboss.as.server] (ServerService Thread Pool -- 29) JBAS018559: Deployed "earth.war" (runtime-name : "earth.war")
[INFO] [talledLocalContainer] 09:43:01,898 INFO [org.jboss.as.server] (ServerService Thread Pool -- 29) JBAS018559: Deployed "cargocpc.war" (runtime-name : "cargocpc.war")
[INFO] [talledLocalContainer] 09:43:01,899 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.jdbc.EarthDS (missing) dependents: [service jboss.persistenceunit."earth.war#earth".__FIRST_PHASE__]
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] 09:43:01,908 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
[INFO] [talledLocalContainer] 09:43:01,909 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
[INFO] [talledLocalContainer] 09:43:01,909 ERROR [org.jboss.as] (Controller Boot Thread) JBAS015875: WildFly 8.0.0.Final "WildFly" started (with errors) in 2415ms - Started 262 of 318 services (2 services failed or missing dependencies, 92 services are lazy, passive or on-demand)
[INFO] [talledLocalContainer] WildFly 8.x is stopping...
[INFO] [talledLocalContainer] 09:43:02,137 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015877: Stopped deployment earth.war (runtime-name: earth.war) in 14ms
[INFO] [talledLocalContainer] 09:43:02,185 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018558: Undeployed "earth.war" (runtime-name: "earth.war")
[INFO] [talledLocalContainer] 09:43:02,186 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] [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:43:02,806 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.jdbc.EarthDS (no longer required)
[INFO] [talledLocalContainer] service jboss.persistenceunit."earth.war#earth".__FIRST_PHASE__ (no longer required)
[INFO] [talledLocalContainer]
[INFO] [talledLocalContainer] INFO [org.jboss.as.cli.CommandContext] {"outcome" => "success"}
[INFO] [talledLocalContainer] {"outcome" => "success"}
[INFO] [talledLocalContainer] 09:43:02,813 INFO [org.wildfly.extension.undertow] (MSC service thread 1-10) JBAS017535: Unregistered web context: /cargocpc
Can someone please help me understand what is not right here?
Thanks
in the doc snippet, the name has 4 parts
in your example, it has only the 3 parts
Since cargo can configure multiple datasources, would the 4th part be required to uniquely identify them?
Use the same jndi string as in persistence.xml and specify file or mem in the jdbc string:
<cargo.datasource.datasource.h2>
cargo.datasource.jndi=java:/jdbc/EarthDS|
cargo.datasource.driver=org.h2.Driver|
cargo.datasource.url=jdbc:h2:mem:earth;create=true|
cargo.datasource.username=sa|
cargo.datasource.password=sa
</cargo.datasource.datasource.h2>
Make sure the container has a dependency for the h2 driver:
<container>
...
<dependencies>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
</dependencies>
</container>
And that the h2 driver is listed in the maven depedencies:
<dependencies>
...
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.182</version>
</dependency>
</dependencies>
I am getting following error while deploying our EAR to JBoss AS 7.1 as a standalone deployment. Please see the server error log and help me out in what I need to do for it to start functioning correctly. Thank You
12:21:47,165 INFO [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem
12:21:47,167 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.
12:21:47,211 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem
12:21:47,211 INFO [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem
12:21:47,212 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
12:21:47,215 INFO [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem
12:21:47,219 INFO [org.jboss.as.security] (MSC service thread 1-5) JBAS013100: Current PicketBox version=4.0.7.Final
12:21:47,232 INFO [org.jboss.as.naming] (MSC service thread 1-1) JBAS011802: Starting Naming Service
12:21:47,250 INFO [org.jboss.as.connector] (MSC service thread 1-8) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)
12:21:47,262 INFO [org.jboss.as.mail.extension] (MSC service thread 1-2) JBAS015400: Bound mail session [java:jboss/mail/Default]
12:21:47,328 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
12:21:47,467 INFO [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-1) JBoss Web Services - Stack CXF Server 4.0.2.GA
12:21:47,624 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-3) Starting Coyote HTTP/1.1 on http--127.0.0.1-8085
12:21:47,658 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-4) JBAS015012: Started FileSystemDeploymentService for directory D:\jboss-as-7.1.1.Final\standalone\deployments
12:21:47,659 INFO [org.jboss.as.remoting] (MSC service thread 1-8) JBAS017100: Listening on /127.0.0.1:4447
12:21:47,660 INFO [org.jboss.as.remoting] (MSC service thread 1-5) JBAS017100: Listening on /127.0.0.1:9999
12:21:47,808 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-7) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
12:21:48,018 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.jdbc-driver.ojdbc14-10_2_0_5_jar (missing) dependents: [service jboss.data-source.java:/jdbc/DefaultDS]
12:21:48,036 INFO [org.jboss.as.server.deployment] (MSC service thread 1-5) JBAS015876: Starting deployment of "Shrisurance.ear"
12:21:54,210 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.deployment.unit."Shrisurance.ear".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."Shrisurance.ear".STRUCTURE: Failed to process phase STRUCTURE of deployment "Shrisurance.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_25]
at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_25]
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: Failed to get manifest for deployment "/D:/jboss-as-7.1.1.Final/bin/content/Shrisurance.ear/Shrisurance.war"
at org.jboss.as.server.deployment.module.ManifestAttachmentProcessor.deploy(ManifestAttachmentProcessor.java:73) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:113) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 5 more
Caused by: java.io.IOException: invalid header field
at java.util.jar.Attributes.read(Attributes.java:393) [rt.jar:1.6.0_25]
at java.util.jar.Manifest.read(Manifest.java:182) [rt.jar:1.6.0_25]
at java.util.jar.Manifest.<init>(Manifest.java:52) [rt.jar:1.6.0_25]
at org.jboss.vfs.VFSUtils.readManifest(VFSUtils.java:216) [jboss-vfs-3.1.0.Final.jar:3.1.0.Final]
at org.jboss.vfs.VFSUtils.getManifest(VFSUtils.java:199) [jboss-vfs-3.1.0.Final.jar:3.1.0.Final]
at org.jboss.as.server.deployment.module.ManifestAttachmentProcessor.deploy(ManifestAttachmentProcessor.java:69) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
... 6 more
12:21:54,257 INFO [org.jboss.as] (MSC service thread 1-5) JBAS015951: Admin console listening on http://127.0.0.1:9990
12:21:54,257 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "Shrisurance.ear" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"Shrisurance.ear\".STRUCTURE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"Shrisurance.ear\".STRUCTURE: Failed to process phase STRUCTURE of deployment \"Shrisurance.ear\""}}
12:21:54,258 ERROR [org.jboss.as] (MSC service thread 1-5) JBAS015875: JBoss AS 7.1.1.Final "Brontes" started (with errors) in 7927ms - Started 136 of 215 services (3 services failed or missing dependencies, 74 services are passive or on-demand)
12:21:54,266 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015877: Stopped deployment Shrisurance.ear in 7ms
12:21:54,267 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014777: Services which failed to start: service jboss.deployment.unit."Shrisurance.ear".STRUCTURE: org.jboss.msc.service.StartException in service jboss.deployment.unit."Shrisurance.ear".STRUCTURE: Failed to process phase STRUCTURE of deployment "Shrisurance.ear"
12:21:54,277 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"Shrisurance.ear\".STRUCTURE" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"Shrisurance.ear\".STRUCTURE: Failed to process phase STRUCTURE of deployment \"Shrisurance.ear\""}}}}
12:22:02,431 INFO [org.jboss.as.osgi] (MSC service thread 1-3) JBAS011942: Stopping OSGi Framework
Case 1 : Looking from log
New missing/unsatisfied dependencies:
service jboss.jdbc-driver.ojdbc14-10_2_0_5_jar
It is found that you are using ojdbc14 version of jar. It is for JDK 1.4. If you are using JDK 1.4+ version then use ojdbc14+ driver. Latest Oracle Driver Download Link
Modify module.xml ( # jboss-as-web-7.0.2.Final\modules\com\oracle\ojdbcXXX\main )
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.oracle.ojdbcXXX">
<resources>
<resource-root path="ojdbcXXX.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
Add ojdbcXXX.jar ( # jboss-as-web-7.0.2.Final\modules\com\oracle\ojdbcXXX\main )
Define Data-source in standalone.xml
<datasource jndi-name="java:/OracleDS" pool-name="OracleDS">
<connection-url>jdbc:oracle:thin:#host:port:SID</connection-url>
<driver>ojdbcXXX</driver>
</datasource>
<drivers>
<driver name="ojdbcXXX" module="com.oracle.ojdbcXXX">
<xa-datasource-class>oracle.jdbc.xa.client.OracleXADataSource</xa-datasource-class>
</driver>
</drivers>
Case 2 : Include other deployments in EAR
JBoss find that dependency spurious. If your EAR contains other deployments like .jar or.war then you can try below :-
<jboss-deployment-structure>
<ear-subdeployments-isolated>false</ear-subdeployments-isolated>
</jboss-deployment-structure>