JBoss AS 7 and MySQL - Can't start server - java

I've followed this tutorial to set up MySQL with JBoss AS 7. Unfortunately the server hangs on the message:
INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-1) Starting Coyote HTTP/1.1 on http--127.0.0.1-8080
And nothing happens.
What could cause this problem?
Full log:
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /Applications/JBoss
JAVA: /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/bin/java
JAVA_OPTS: -server -XX:+UseCompressedOops -XX:+TieredCompilation -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.server.default.config=standalone.xml
=========================================================================
11:42:35,759 INFORMATION [org.jboss.modules] JBoss Modules version 1.1.1.GA
11:42:36,067 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA
11:42:36,139 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting
11:42:37,280 INFO [org.xnio] XNIO Version 3.0.3.GA
11:42:37,294 INFO [org.xnio.nio] XNIO NIO Implementation Version 3.0.3.GA
11:42:37,292 INFO [org.jboss.as.server] JBAS015888: Creating http management service using socket-binding (management-http)
11:42:37,305 INFO [org.jboss.remoting] JBoss Remoting version 3.2.3.GA
11:42:37,379 INFO [org.jboss.as.logging] JBAS011502: Removing bootstrap log handlers
11:42:37,383 INFO [org.jboss.as.configadmin] (ServerService Thread Pool -- 26) JBAS016200: Activating ConfigAdmin Subsystem
11:42:37,454 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.
11:42:37,483 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
11:42:37,510 INFO [org.jboss.as.connector] (MSC service thread 1-4) JBAS010408: Starting JCA Subsystem (JBoss IronJacamar 1.0.9.Final)
11:42:37,537 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.fabric.jdbc.FabricMySQLDriver (version 5.1)
11:42:37,579 INFO [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013101: Activating Security Subsystem
11:42:37,590 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 38) JBAS011800: Activating Naming Subsystem
11:42:37,592 INFO [org.jboss.as.osgi] (ServerService Thread Pool -- 39) JBAS011940: Activating OSGi Subsystem
11:42:37,605 INFO [org.jboss.as.security] (MSC service thread 1-2) JBAS013100: Current PicketBox version=4.0.7.Final
11:42:37,624 INFO [org.jboss.as.naming] (MSC service thread 1-1) JBAS011802: Starting Naming Service
11:42:37,634 INFO [org.jboss.as.mail.extension] (MSC service thread 1-1) JBAS015400: Bound mail session [java:jboss/mail/Default]
11:42:37,682 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
11:42:37,565 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 27) JBAS014612: Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("jdbc-driver" => "mysql")
]): org.jboss.msc.service.DuplicateServiceException: Service jboss.jdbc-driver.mysql is already registered
at org.jboss.msc.service.ServiceRegistrationImpl.setInstance(ServiceRegistrationImpl.java:154) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl.startInstallation(ServiceControllerImpl.java:227) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceContainerImpl.install(ServiceContainerImpl.java:560) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceTargetImpl.install(ServiceTargetImpl.java:201) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$ChildServiceTarget.install(ServiceControllerImpl.java:2228) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceBuilderImpl.install(ServiceBuilderImpl.java:307) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.as.controller.OperationContextImpl$ContextServiceBuilder.install(OperationContextImpl.java:955) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.connector.subsystems.datasources.JdbcDriverAdd.startDriverServices(JdbcDriverAdd.java:164) [jboss-as-connector-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.connector.subsystems.datasources.JdbcDriverAdd.performRuntime(JdbcDriverAdd.java:128) [jboss-as-connector-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.AbstractAddStepHandler$1.execute(AbstractAddStepHandler.java:50) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:385) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:272) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:200) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.connector.subsystems.datasources.DataSourceEnable$1.execute(DataSourceEnable.java:91) [jboss-as-connector-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:385) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:272) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:200) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.connector.subsystems.datasources.DataSourceEnable$1.execute(DataSourceEnable.java:91) [jboss-as-connector-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:385) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.AbstractOperationContext.doCompleteStep(AbstractOperationContext.java:272) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.AbstractOperationContext.completeStep(AbstractOperationContext.java:200) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.ParallelBootOperationStepHandler$ParallelBootTask.run(ParallelBootOperationStepHandler.java:311) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_71]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_71]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_71]
at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.0.0.GA.jar:2.0.0.GA]
11:42:38,026 INFO [org.jboss.ws.common.management.AbstractServerConfig] (MSC service thread 1-3) JBoss Web Services - Stack CXF Server 4.0.2.GA
11:42:38,116 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-1) Starting Coyote HTTP/1.1 on http--127.0.0.1-8080
This is the corresponding content of my standalone.xml:
<datasources>
<datasource
jndi-name="java:/database" pool-name="mySQLPool"
enabled="true" jta="true"
use-java-context="true" use-ccm="true">
<connection-url>
jdbc:mysql://localhost:3306/database
</connection-url>
<driver>
mysql
</driver>
<security>
<user-name>
username
</user-name>
<password>
password
</password>
</security>
<statement>
<prepared-statement-cache-size>
100
</prepared-statement-cache-size>
<share-prepared-statements/>
</statement>
</datasource>
<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</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
<drivers>
<driver name="mysql" module="com.mysql"/>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>
org.h2.jdbcx.JdbcDataSource
</xa-datasource-class>
</driver>
</drivers>
</datasources>
Whereas database, username and password are set correctly.

The problem is 2 driver definitions in META-INF/services/java.sql.Driver.Also this problem may be cause by MySQL Driver version.
1)Change your MySQL Driver version.(May be MySQL JDBC Driver 5.1.30 and up has this issues, you should change lower version)
OR
2)Add eg: line to the "drivers" section in the subsystem "datasources" in standalone.xml
eg:
<driver-class>com.mysql.jdbc.Driver</driver-class>

I had the same issue, but could resolve by downgrading the MySQL driver version to mysql-connector-java-5.1.29.jar
Here is the module.xml
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.29.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
Works well with JBoss AS 7.1.1
:Vinod.

Related

JBAS014613: Operation ("deploy") failed - address: ([("deployment" => "test.war")])

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.

NullPointerException in EJB dependency injection

I'm developing the RESTful web app using jersey, EJB. Using JBoss version 6.4.0
My rest controllers work fine without EJB dependency injection, but when I try to use EJB dependency injection it throws NullPointerException in REST controller.
My controller Controller
#Path("message")
public class DocumentController {
#EJB
private TestService testService;
#GET
public String greeting()
{
return testService.greeting(); // testService is null in there !!!
}
}
My Service
#Stateless
public class TestServiceImpl implements TestService {
#EJB
private SingletonBean singletonBean;
#Override
public String greeting()
{
return singletonBean.getName();
}
}
public interface TestService {
String greeting();
}
The Singleton
#Singleton
public class SingletonBeanImpl implements SingletonBean {
#Override
public String getName()
{
return "Vazgen";
}
}
public interface SingletonBean {
String getName();
}
Maven dependencies
<dependency>
<groupId>org.jboss.spec.javax.ejb</groupId>
<artifactId>jboss-ejb-api_3.1_spec</artifactId>
<version>1.0.2.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<version>2.25.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.0</version>
<scope>provided</scope>
</dependency>
Im disabled resteasy
web.xml file
<?xml version="1.0" encoding="ISO-8859-1" ?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<display-name>Application display name</display-name>
<servlet>
<servlet-name>Jersey REST Service</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.packages</param-name>
<param-value>com.myorg.application.controller</param-value>
</init-param>
<init-param>
<param-name>com.sun.jersey.api.json.POJOMappingFeature</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Jersey REST Service</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>resteasy.scan.providers</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>resteasy.scan.resources</param-name>
<param-value>false</param-value>
</context-param>
</web-app>
JBoss logs
/usr/lib/jvm/java-8-oracle/bin/java -Dfile.encoding=UTF-8 -classpath /home/user/jsboss-install-dir/idea-IU-173.4548.28/lib/idea_rt.jar com.intellij.rt.execution.CommandLineWrapper /tmp/idea_classpath com.intellij.javaee.oss.process.JavaeeProcess 35135 com.intellij.javaee.oss.jboss.agent.JBoss71Agent
/home/user/jsboss-install-dir/EAP-6.4.0/bin/standalone.sh
[2018-03-23 12:18:15,364] Artifact my-app:war exploded: Waiting for server connection to start artifact deployment...
Detected server admin port: 9999
Detected server http port: 8080
JAVA_OPTS already set in environment; overriding default settings with values: -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:40537,suspend=y,server=n -javaagent:/home/user/jsboss-install-dir/idea-IU-173.4548.28/lib/rt/debugger-agent.jar=/tmp/capture.props
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /home/user/jsboss-install-dir/EAP-6.4.0
JAVA: /usr/lib/jvm/java-8-oracle/bin/java
JAVA_OPTS: -server -XX:+UseCompressedOops -verbose:gc -Xloggc:"/home/user/jsboss-install-dir/EAP-6.4.0/standalone/log/gc.log" -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=5 -XX:GCLogFileSize=3M -XX:-TraceClassUnloading -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:40537,suspend=y,server=n -javaagent:/home/user/jsboss-install-dir/idea-IU-173.4548.28/lib/rt/debugger-agent.jar=/tmp/capture.props
=========================================================================
Connected to the target VM, address: '127.0.0.1:40537', transport: 'socket'
12:18:15,746 INFO [org.jboss.modules] (main) JBoss Modules version 1.3.6.Final-redhat-1
12:18:15,951 INFO [org.jboss.msc] (main) JBoss MSC version 1.1.5.Final-redhat-1
12:18:16,110 INFO [org.jboss.as] (MSC service thread 1-8) JBAS015899: JBoss EAP 6.4.0.GA (AS 7.5.0.Final-redhat-21) starting
12:18:17,193 INFO [org.xnio] (MSC service thread 1-3) XNIO Version 3.0.13.GA-redhat-1
12:18:17,197 INFO [org.xnio.nio] (MSC service thread 1-3) XNIO NIO Implementation Version 3.0.13.GA-redhat-1
12:18:17,204 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
12:18:17,215 INFO [org.jboss.remoting] (MSC service thread 1-3) JBoss Remoting version 3.3.4.Final-redhat-1
12:18:17,276 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 31) JBAS010280: Activating Infinispan subsystem.
12:18:17,282 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
12:18:17,317 INFO [org.jboss.as.security] (ServerService Thread Pool -- 44) JBAS013371: Activating Security Subsystem
12:18:17,323 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 39) JBAS011800: Activating Naming Subsystem
12:18:17,326 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 48) JBAS015537: Activating WebServices Extension
12:18:17,332 WARN [org.jboss.as.txn] (ServerService Thread Pool -- 46) JBAS010153: Node identifier property is set to the default value. Please make sure it is unique.
12:18:17,335 INFO [org.jboss.as.security] (MSC service thread 1-5) JBAS013370: Current PicketBox version=4.1.1.Final-redhat-1
12:18:17,351 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 37) JBAS012615: Activated the following JSF Implementations: [main, 1.2]
12:18:17,359 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 27) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
12:18:17,420 INFO [org.jboss.as.naming] (MSC service thread 1-8) JBAS011802: Starting Naming Service
12:18:17,421 INFO [org.jboss.as.mail.extension] (MSC service thread 1-3) JBAS015400: Bound mail session [java:jboss/mail/Default]
12:18:17,422 INFO [org.jboss.as.connector.logging] (MSC service thread 1-3) JBAS010408: Starting JCA Subsystem (IronJacamar 1.0.31.Final-redhat-1)
12:18:17,760 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-5) JBWEB003001: Coyote HTTP/1.1 initializing on : http-/127.0.0.1:8080
12:18:17,769 INFO [org.apache.coyote.http11.Http11Protocol] (MSC service thread 1-5) JBWEB003000: Coyote HTTP/1.1 starting on: http-/127.0.0.1:8080
12:18:17,846 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-1) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
12:18:17,846 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) JBAS010400: Bound data source [java:jboss/datasources/employee_storage]
12:18:17,872 INFO [org.jboss.as.remoting] (MSC service thread 1-5) JBAS017100: Listening on 127.0.0.1:9999
12:18:17,873 INFO [org.jboss.as.remoting] (MSC service thread 1-8) JBAS017100: Listening on 127.0.0.1:4447
12:18:17,888 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-6) JBAS015012: Started FileSystemDeploymentService for directory /home/user/jsboss-install-dir/EAP-6.4.0/standalone/deployments
12:18:17,906 INFO [org.jboss.ws.common.management] (MSC service thread 1-2) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.3.4.Final-redhat-1
Mar 23, 2018 12:18:17 PM org.xnio.Xnio <clinit>
INFO: XNIO Version 3.0.13.GA-redhat-1
Mar 23, 2018 12:18:18 PM org.xnio.nio.NioXnio <clinit>
INFO: XNIO NIO Implementation Version 3.0.13.GA-redhat-1
Mar 23, 2018 12:18:18 PM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 3.3.4.Final-redhat-1
12:18:18,128 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
12:18:18,128 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
12:18:18,128 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss EAP 6.4.0.GA (AS 7.5.0.Final-redhat-21) started in 2657ms - Started 159 of 197 services (57 services are lazy, passive or on-demand)
Connected to server
[2018-03-23 12:18:18,519] Artifact my-app:war exploded: Artifact is being deployed, please wait...
12:18:18,668 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "my-app" (runtime-name: "my-app.war")
12:18:19,387 INFO [org.jboss.as.jpa] (MSC service thread 1-7) JBAS011401: Read persistence.xml for employeeUnit
12:18:19,553 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-3) JNDI bindings for session bean named SingletonBeanImpl in deployment unit deployment "my-app.war" are as follows:
java:global/my-app/SingletonBeanImpl!com.egs.preparation.rest.service.SingletonBean
java:app/my-app/SingletonBeanImpl!com.egs.preparation.rest.service.SingletonBean
java:module/SingletonBeanImpl!com.egs.preparation.rest.service.SingletonBean
java:global/my-app/SingletonBeanImpl
java:app/my-app/SingletonBeanImpl
java:module/SingletonBeanImpl
12:18:19,553 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1-3) JNDI bindings for session bean named TestServiceImpl in deployment unit deployment "my-app.war" are as follows:
java:global/my-app/TestServiceImpl!com.egs.preparation.rest.service.TestService
java:app/my-app/TestServiceImpl!com.egs.preparation.rest.service.TestService
java:module/TestServiceImpl!com.egs.preparation.rest.service.TestService
java:global/my-app/TestServiceImpl
java:app/my-app/TestServiceImpl
java:module/TestServiceImpl
12:18:19,706 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
12:18:19,707 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-6) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.fabric.jdbc.FabricMySQLDriver (version 5.1)
12:18:19,729 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 25) JBAS011402: Starting Persistence Unit Service 'my-app#employeeUnit'
12:18:19,837 INFO [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 25) HCANN000001: Hibernate Commons Annotations {4.0.2.Final-redhat-1}
12:18:20,762 INFO [org.jboss.web] (ServerService Thread Pool -- 24) JBAS018210: Register web context: /my-app
12:18:20,907 INFO [org.jboss.as.server] (management-handler-thread - 2) JBAS015859: Deployed "my-app" (runtime-name : "my-app.war")
[2018-03-23 12:18:20,935] Artifact my-app:war exploded: Artifact is deployed successfully
[2018-03-23 12:18:20,935] Artifact my-app:war exploded: Deploy took 2,416 milliseconds
12:18:26,750 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/my-app].[Jersey REST Service]] (http-/127.0.0.1:8080-2) JBWEB000236: Servlet.service() for servlet Jersey REST Service threw exception: java.lang.NullPointerException
at com.egs.preparation.rest.controller.DocumentResourceBean.greeting(DocumentResourceBean.java:43) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.8.0_161]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [rt.jar:1.8.0_161]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.8.0_161]
at java.lang.reflect.Method.invoke(Method.java:498) [rt.jar:1.8.0_161]
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81) [jersey-server-2.25.1.jar:]
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher$1.run(AbstractJavaResourceMethodDispatcher.java:144) [jersey-server-2.25.1.jar:]
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:161) [jersey-server-2.25.1.jar:]
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$TypeOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:205) [jersey-server-2.25.1.jar:]
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:99) [jersey-server-2.25.1.jar:]
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:389) [jersey-server-2.25.1.jar:]
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:347) [jersey-server-2.25.1.jar:]
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:102) [jersey-server-2.25.1.jar:]
at org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:326) [jersey-server-2.25.1.jar:]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271) [jersey-common-2.25.1.jar:]
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267) [jersey-common-2.25.1.jar:]
at org.glassfish.jersey.internal.Errors.process(Errors.java:315) [jersey-common-2.25.1.jar:]
at org.glassfish.jersey.internal.Errors.process(Errors.java:297) [jersey-common-2.25.1.jar:]
at org.glassfish.jersey.internal.Errors.process(Errors.java:267) [jersey-common-2.25.1.jar:]
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317) [jersey-common-2.25.1.jar:]
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305) [jersey-server-2.25.1.jar:]
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154) [jersey-server-2.25.1.jar:]
at org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:473) [jersey-container-servlet-core-2.25.1.jar:]
at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:427) [jersey-container-servlet-core-2.25.1.jar:]
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:388) [jersey-container-servlet-core-2.25.1.jar:]
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:341) [jersey-container-servlet-core-2.25.1.jar:]
at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:228) [jersey-container-servlet-core-2.25.1.jar:]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) [jboss-as-jpa-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) [jboss-as-web-7.5.0.Final-redhat-21.jar:7.5.0.Final-redhat-21]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:150) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:854) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926) [jbossweb-7.5.7.Final-redhat-1.jar:7.5.7.Final-redhat-1]
at java.lang.Thread.run(Thread.java:748) [rt.jar:1.8.0_161]
Could you help me understand what is a problem?

Referencing a datasource with JNDI name in persistence.xml

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.

EAR Deployment in JBoss AS 7

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>

JPA, JBoss, Hibernate, Persistence.createEntityManagerFactory returns null

I am trying to setup a simple project, where I have a REST service query a database using JPA/Hibernate. My platform is Windows, MySQL 5.6, and JBoss (Wildfly) 8 with hibernate 4.3. My project setup:
PersonApp (Eclipse Java Enterprise Project) >PersonApp.ear
-PersonData (Eclipse JPA Project) >PersonData.jar
-PersonRest (Eclipse Dynamic Web Project) >PersonRest.war
PersonData project contains 1 entity class (Person.java), a manager class for peforming the em.find and em.persist through EntityManager (PersonManager.java), and persistance.xml
PersonRest project contains one REST service, with one GET method, which calls the PersonManager class to query all Persons.
PersonApp is just a container project which includes PersonData and PersonRest as modules.
Now for the issue: I deploy PersonApp.ear to Wildfly 8 (JBoss), and navigate to the service URL in a web browser. PersonRest service calls PersonManager class, which calls Persistence.createEntityManagerFactor("PersonData"); This line returns 'null' and I have no idea why.
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="PersonData" transaction-type="JTA">
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<jta-data-source>java:jboss/datasources/MySqlDS</jta-data-source>
<class>com.csc.data.Person</class>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
<property name="hibernate.hbm2ddl.auto" value="create-drop"/>
</properties>
</persistence-unit>
</persistence>
Wildfly startup output (shows app deployment, data source loaded, persistence unit):
14:31:14,607 INFO [org.jboss.modules] (main) JBoss Modules version 1.3.0.Final
14:31:14,841 INFO [org.jboss.msc] (main) JBoss MSC version 1.2.0.Final
14:31:14,919 INFO [org.jboss.as] (MSC service thread 1-6) JBAS015899: WildFly 8.0.0.Final "WildFly" starting
14:31:15,871 INFO [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015003: Found PersonApp.ear in deployment directory. To trigger deployment create a file called PersonApp.ear.dodeploy
14:31:15,887 INFO [org.jboss.as.server] (Controller Boot Thread) JBAS015888: Creating http management service using socket-binding (management-http)
14:31:15,903 INFO [org.xnio] (MSC service thread 1-8) XNIO version 3.2.0.Final
14:31:15,919 INFO [org.xnio.nio] (MSC service thread 1-8) XNIO NIO Implementation Version 3.2.0.Final
14:31:15,934 INFO [org.jboss.as.clustering.infinispan] (ServerService Thread Pool -- 33) JBAS010280: Activating Infinispan subsystem.
14:31:15,950 INFO [org.jboss.as.security] (ServerService Thread Pool -- 46) JBAS013171: Activating Security Subsystem
14:31:15,966 INFO [org.jboss.as.webservices] (ServerService Thread Pool -- 50) JBAS015537: Activating WebServices Extension
14:31:15,997 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017502: Undertow 1.0.0.Final starting
14:31:15,997 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 49) JBAS017502: Undertow 1.0.0.Final starting
14:31:15,997 INFO [org.jboss.as.security] (MSC service thread 1-2) JBAS013170: Current PicketBox version=4.0.20.Final
14:31:15,997 INFO [org.jboss.as.naming] (ServerService Thread Pool -- 41) JBAS011800: Activating Naming Subsystem
14:31:15,997 INFO [org.jboss.as.jsf] (ServerService Thread Pool -- 39) JBAS012615: Activated the following JSF Implementations: [main]
14:31:16,028 INFO [org.jboss.as.connector.logging] (MSC service thread 1-5) JBAS010408: Starting JCA Subsystem (IronJacamar 1.1.3.Final)
14:31:16,075 INFO [org.jboss.as.naming] (MSC service thread 1-5) JBAS011802: Starting Naming Service
14:31:16,075 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 28) JBAS010403: Deploying JDBC-compliant driver class org.h2.Driver (version 1.3)
14:31:16,090 INFO [org.jboss.as.mail.extension] (MSC service thread 1-6) JBAS015400: Bound mail session [java:jboss/mail/Default]
14:31:16,106 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 28) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver (version 5.1)
14:31:16,106 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) JBAS010417: Started Driver service with driver-name = h2
14:31:16,106 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) JBAS010417: Started Driver service with driver-name = com.mysql
14:31:16,184 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 49) JBAS017527: Creating file handler for path C:\wildfly-8.0.0.Final/welcome-content
14:31:16,200 INFO [org.jboss.remoting] (MSC service thread 1-1) JBoss Remoting version 4.0.0.Final
14:31:16,434 INFO [org.wildfly.extension.undertow] (MSC service thread 1-2) JBAS017525: Started server default-server.
14:31:16,543 INFO [org.wildfly.extension.undertow] (MSC service thread 1-2) JBAS017531: Host default-host starting
14:31:16,605 INFO [org.wildfly.extension.undertow] (MSC service thread 1-6) JBAS017519: Undertow HTTP listener default listening on localhost/127.0.0.1:8080
14:31:16,652 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-4) JBAS010400: Bound data source [java:jboss/datasources/MySqlDS]
14:31:16,730 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "PersonApp.ear" (runtime-name: "PersonApp.ear")
14:31:16,746 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-7) JBAS015012: Started FileSystemDeploymentService for directory C:\wildfly-8.0.0.Final\standalone\deployments
14:31:16,761 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-7) JBAS010400: Bound data source [java:jboss/datasources/ExampleDS]
14:31:16,824 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBAS015876: Starting deployment of "null" (runtime-name: "PersonRest.war")
14:31:16,855 INFO [org.jboss.ws.common.management] (MSC service thread 1-6) JBWS022052: Starting JBoss Web Services - Stack CXF Server 4.2.3.Final
14:31:16,870 INFO [org.jboss.as.jpa] (MSC service thread 1-3) JBAS011401: Read persistence.xml for PersonData
14:31:16,933 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 52) JBAS011409: Starting Persistence Unit (phase 1 of 2) Service 'PersonApp.ear#PersonData'
14:31:16,948 INFO [org.hibernate.jpa.internal.util.LogHelper] (ServerService Thread Pool -- 52) HHH000204: Processing PersistenceUnitInfo [
name: PersonData
...]
14:31:16,996 INFO [org.hibernate.Version] (ServerService Thread Pool -- 52) HHH000412: Hibernate Core {4.3.1.Final}
14:31:17,012 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 52) HHH000206: hibernate.properties not found
14:31:17,012 INFO [org.hibernate.cfg.Environment] (ServerService Thread Pool -- 52) HHH000021: Bytecode provider name : javassist
14:31:17,152 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 52) JBAS011409: Starting Persistence Unit (phase 2 of 2) Service 'PersonApp.ear#PersonData'
14:31:17,277 INFO [org.hibernate.annotations.common.Version] (ServerService Thread Pool -- 52) HCANN000001: Hibernate Commons Annotations {4.0.4.Final}
14:31:17,511 INFO [org.hibernate.dialect.Dialect] (ServerService Thread Pool -- 52) HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
14:31:17,589 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (ServerService Thread Pool -- 52) HHH000397: Using ASTQueryTranslatorFactory
14:31:17,620 INFO [org.hibernate.validator.internal.util.Version] (ServerService Thread Pool -- 52) HV000001: Hibernate Validator 5.0.3.Final
14:31:17,885 INFO [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 52) HHH000227: Running hbm2ddl schema export
14:31:17,932 INFO [org.hibernate.tool.hbm2ddl.SchemaExport] (ServerService Thread Pool -- 52) HHH000230: Schema export complete
14:31:18,197 INFO [org.jboss.resteasy.spi.ResteasyDeployment] (MSC service thread 1-2) Deploying javax.ws.rs.core.Application: class com.csc.rest.service.PersonRest
14:31:18,197 INFO [org.jboss.resteasy.spi.ResteasyDeployment] (MSC service thread 1-2) Adding singleton resource com.csc.rest.service.PersonService from Application class com.csc.rest.service.PersonRest
14:31:18,323 INFO [org.wildfly.extension.undertow] (MSC service thread 1-2) JBAS017534: Registered web context: /PersonRest
14:31:18,370 INFO [org.jboss.as.server] (ServerService Thread Pool -- 29) JBAS018559: Deployed "PersonApp.ear" (runtime-name : "PersonApp.ear")
14:31:18,417 INFO [org.jboss.as] (Controller Boot Thread) JBAS015961: Http management interface listening on http://127.0.0.1:9990/management
14:31:18,417 INFO [org.jboss.as] (Controller Boot Thread) JBAS015951: Admin console listening on http://127.0.0.1:9990
14:31:18,417 INFO [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.0.0.Final "WildFly" started in 4059ms - Started 291 of 351 services (98 services are lazy, passive or on-demand)
Wildfly output on REST service call:
14:32:06,221 INFO [org.hibernate.jpa.internal.util.LogHelper] (default task-2) HHH000204: Processing PersistenceUnitInfo [
name: PersonData
...]
14:32:06,236 INFO [org.hibernate.dialect.Dialect] (default task-2) HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
14:32:06,236 INFO [org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory] (default task-2) HHH000397: Using ASTQueryTranslatorFactory
14:32:06,252 INFO [org.hibernate.tool.hbm2ddl.SchemaExport] (default task-2) HHH000227: Running hbm2ddl schema export
14:32:06,268 INFO [org.hibernate.tool.hbm2ddl.SchemaExport] (default task-2) HHH000230: Schema export complete
14:32:06,300 ERROR [io.undertow.request] (default task-2) UT005023: Exception handling request to /PersonRest/PersonService: org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException
at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:149) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:372) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51) [resteasy-jaxrs-3.0.6.Final.jar:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:85) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:113) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.security.handlers.AuthenticationCallHandler.handleRequest(AuthenticationCallHandler.java:52) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:168) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:687) [undertow-core-1.0.0.Final.jar:1.0.0.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [rt.jar:1.7.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.7.0_51]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.7.0_51]
Caused by: java.lang.NullPointerException
at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.getStatus(JtaStatusHelper.java:76) [hibernate-core-4.3.1.Final.jar:4.3.1.Final]
at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.isActive(JtaStatusHelper.java:118) [hibernate-core-4.3.1.Final.jar:4.3.1.Final]
at org.hibernate.engine.transaction.internal.jta.CMTTransaction.join(CMTTransaction.java:149) [hibernate-core-4.3.1.Final.jar:4.3.1.Final]
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:1602) [hibernate-entitymanager-4.3.1.Final.jar:4.3.1.Final]
at org.hibernate.jpa.spi.AbstractEntityManagerImpl.postInit(AbstractEntityManagerImpl.java:210) [hibernate-entitymanager-4.3.1.Final.jar:4.3.1.Final]
at org.hibernate.jpa.internal.EntityManagerImpl.<init>(EntityManagerImpl.java:91) [hibernate-entitymanager-4.3.1.Final.jar:4.3.1.Final]
at org.hibernate.jpa.internal.EntityManagerFactoryImpl.internalCreateEntityManager(EntityManagerFactoryImpl.java:345) [hibernate-entitymanager-4.3.1.Final.jar:4.3.1.Final]
at org.hibernate.jpa.internal.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:313) [hibernate-entitymanager-4.3.1.Final.jar:4.3.1.Final]
at com.csc.data.PersonManager.openConnection(PersonManager.java:51) [PersonData.jar:]
at com.csc.rest.service.PersonService.getAllPersons(PersonService.java:21) [classes:]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_51]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_51]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [rt.jar:1.7.0_51]
at java.lang.reflect.Method.invoke(Unknown Source) [rt.jar:1.7.0_51]
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:137) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:280) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:234) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:221) [resteasy-jaxrs-3.0.6.Final.jar:]
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356) [resteasy-jaxrs-3.0.6.Final.jar:]
... 29 more
It looks like Wildfly is able to find persistance.xml, and it is able to connect to the MySQL database (it even drops the table data as expected). It shows in the output that it found the persistence unit PersonData. I even tried changing the provider to something off the wall just to see if it would error. It did error saying it couldn't find the provider class. I changed it back and the error went away, so I assume it is able to find the provider. What am I missing?
I found the solution. In my REST service, I was instantiating the PersonManager class myself. Instead, I needed to inject it with #Inject. After this, it worked, almost. I then had a problem getting CDI to work inside a RESTeasy REST service, but that was a separate issue. More details can be found here in my JBoss community thread: https://community.jboss.org/message/863014#863014

Categories