Skip to main content

Register MySQL On Wildfly 8(JBOSS SERVER 8)

This is quick trick to register MySQL on Wildfly 8.
 Goto WILDFLY_HOME/modules/system/layers/base/com and create another directories mysql/main
Inside the main directory, paste the myql.jar<version>  file inside  and create a "module.xml" file with the follow lines without the code

    <?xml version="1.0" encoding="UTF-8"?>
        <module xmlns="urn:jboss:module:1.1" name="com.mysql">
            <resources>
                <resource-root path="mysql-connector-java-5.1.30-bin.jar"/>
            </resources>
            <dependencies>
                <module name="javax.api"/>
                <module name="javax.transaction.api"/>
            </dependencies>
        </module>


After this, goto the wildfly[HOME]\standalone\configuration\standalone-full.xml
add the driver name.

     <datasources>
        {...}
        <drivers>
            {...}
            <driver name="mysql" module="com.mysql">
                <driver-class>com.mysql.jdbc.Driver</driver-class>
            </driver>
        </drivers>
    </datasources>


After this restart your server. Then proceed the JBoss management Web Page to configure your new datasource.

NB: make sure the datasource name is the same as the driver name you use above.

Reference: http://wildfly.org/news/2014/02/06/GlassFish-to-WildFly-migration/


Comments