JBoss doesn't like my datasource
bonbonbaron Mar 28, 2014 2:38 PMHi! JBoss AS 7 newbie here, so go easy on me.
I have an EJB3 login component I'm attaching as a Maven dependency to this project. That component has a persistence.xml file which USED to point to mysql-ds.xml for JBoss 6, but I went in and at least tried to revamp it for JBoss AS 7. The server loads my JAX-RS resources just fine, but when it gets to the LoginDS, it dies.
I think my bottom-line issue here is JNDI. I have no idea how to add anything to JNDI. It seems like the application server automatically handles most of the JNDI stuff for me though.
I inserted data source information into my standalone.xml like so:
<datasources>
<datasource jta="true" jndi-name="java:jboss/datasources/LoginDS" pool-name="LoginDS" enabled="true" use-java-context="true">
<connection-url>jdbc:mysql://localhost:3306/loginUsers</connection-url>
<driver name="mysql" module="com.mysql">mysql</driver>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>100</max-pool-size>
</pool>
<security>
<user-name>root</user-name>
<password>bondstone</password>
</security>
</datasource>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
My persistence.xml file inside of my EJB3 project looks like this:
<?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_1_0.xsd"
version="1.0">
<persistence-unit name="LoginPersistenceUnit">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jboss/datasources/LoginDS</jta-data-source>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>
</persistence>
So then I put a module.xml along with the mysql-connector-java-5.1.29-5.1.29.jar inside of ${jboss_home}/modules/com/mysql/main.
<?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-bin.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
All of this, and I still get the following error message. I'm sure it has something to do with getting my datasource called "LoginDS" onto JNDI.
21:42:00,051 INFO [org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-5) JBAS010404: Deploying non-JDBC-compliant driver class com.mysql.jdbc.Driver(version 5.1)
21:42:00,140 INFO [org.jboss.as] (MSC service thread 1-5)JBAS015951: Admin console listening on http://127.0.0.1:9990
21:42:00,140 ERROR [org.jboss.as] (MSC service thread 1-5) JBAS015875: JBoss AS 7.1.1.Final "Brontes" started (with errors) in 2534ms - Started 194 of 287 services (16 services failed or missing dependencies, 76 services are passive or on-demand)
21:42:00,340 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "stalker.war" was rolled back with failure message {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"stalker.war#LoginPersistenceUnit\"jboss.naming.context.java.LoginDSMissing[jboss.persistenceunit.\"stalker.war#LoginPersistenceUnit\"jboss.naming.context.java.LoginDS]"]}
21:42:00,359 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBAS015877: Stopped deployment stalker.war in 18ms
21:42:00,361 INFO [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.naming.context.java.LoginDS (missing) dependents: [service jboss.persistenceunit."stalker.war#LoginPersistenceUnit"]
21:42:00,362 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014771: Services with missing/unavailable dependencies" => ["jboss.persistenceunit.\"stalker.war#LoginPersistenceU
nit\"jboss.naming.context.java.LoginDSMissing[jboss.persistenceunit.\"stalker.wa
r#LoginPersistenceUnit\"jboss.naming.context.java.LoginDS]"]}}}
Thanks in advance!