August 22, 2013

Complete Configuration of MySQL 5 DataSource in JBoss EAP 6

Introduction

Here I will describe how to configure a MySQL 5 DataSource for JBoss EAP 6.

Install MySQL JDBC Driver as JBoss EAP 6 Module

Create a new directory under modules and a new module.xml file.

Download the MySQL JDBC driver and put it in the same catalog as module.xml. If necessary correct resource path below, with the downloaded jdbc driver file name.

If this is a server installation make sure that the new directories and files get the right permission.

Configure JBoss EAP 6 DataSource

Here we will use JBoss EAP 6 in standalone mode, but if you like to use the domain mode, the configuration is the same. Open $JBOSS_HOME/standalone/configuration/standalone.xml.

Reference

3 comments:

MrW. said...

To anyone who follows this example and runs into the dreadful error "Failed to load module for driver [com.mysql]" it's very likely that you used a too new MySQL driver with the latest version of JBoss. It's a known issue. For example, JBoss EAP 6.2.0.GA and driver 5.0.8 works fine but not with the 5.1.28 driver.

Anonymous said...

Thanks for this tutorial. However, I have not been able to successfully deploy a MySQL datasource with it and I don't know what the problem is. I created a com/mysql/main directory under the modules directory of my EAP 6.2.0 GA server, and placed mysql-connector-java-5.0.8.jar and a module.xml file there.

Then, I aded a .... configuration to standalone.xml, but cannot start the server without the following error:

JBAS014775: New missing/unsatisfied dependencies:
service jboss.jdbc-driver.mysql (missing) dependents: [service jboss.data-source.java:jboss/datasources/UniaccessDS, service jboss.driver-demander.java:jboss/datasources/UniaccessDS]

So, I removed the configuration from standalone.xml and decided to use EAP admin console to add it. This lead to an Unknown Error complaining about (by my understanding) the MySQL driver.

Details of error messages are here: http://ur1.ca/ha86a
Pls what am I getting wrong ?

Avinash Chodankar said...
This comment has been removed by the author.