I am trying to add a MySQL data source to JBoss AS 7.1.1.
Below is the module.xml file I added in com/mysql/main :
<module xmlns="urn:jboss:module:1.1" name="com.mysql">
<properties>
<resources>
<resource-root path="mysql-connector-java-5.1.34_1.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module>
And this is the datasource I added in standalone.xml and standalone-full.xml:
<datasource jndi-name="java:jboss/datasources/ExampleDS" pool- name="ExampleDS"
enabled="${mysql.enabled}" use-java-context="true">
<connection-url>jdbc:mysql://localhost:3306/myDb</connection-url>
<driver>com.mysql</driver>
<security>
<user-name>root</user-name>
<password>root</password>
</security>
</datasource>
<drivers>
<driver name="com.mysql" module="com.mysql">
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
I've also modified the persistence.xml in my app :
<jta-data-source>java:jboss/datasources/ExampleDS</jta-data-source>
When I start the server, I get this error:
JBAS014775: New missing/unsatisfied dependencies: service jboss.naming.context.java.jboss.datasources.ExampleDS (missing) dependents: [service jboss.persistenceunit."MyApp.war#myAppservice"]
11:03:56,257 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.\"MyApp.war#myAppservice\"jboss.naming.context.java.jboss.datasources.ExampleDSMissing[jboss.persistenceunit.\"MyApp.war#myAppservice\"jboss.naming.context.java.jboss.datasources.ExampleDS]"]}}}
I tried the solution that was here JBoss 7 MySQL datasource issue
and here
https://zorq.net/b/2011/07/12/adding-a-mysql-datasource-to-jboss-as-7/
but nothing works.
<properties>inmodule.xml. Second is you have a space inpool- name="ExampleDS". Did you copy paste it? Maybe there is also some kind of encoding problem. Start with a clean JBoss and try to write it yourself. - wirnse