Search code examples
javajbossmariadbwildfly-8

Error when configuring MariaDB driver on Wildfly server


I am trying to configure a MariaDB datasource on Wildfly. This seems like it should be a simple operation, but I can't seem to get the datasource module to load properly. I have added the maria-java-client-1.1.8.jar archive and a module.xml file to the wildfly-8.2.0.Final/modules/com/mariadb/main directory. The module.xml file is as follows:

<module xmlns:"urn:jboss:module:1.1" name="com.mariadb">
    <resources>
        <resource-root path="mariadb-java-client-1.1.8.jar"/>
    </resources>
    <dependencies>
        <module name="javax.api"/>
        <module name="javax.transaction.api"/>
    </dependencies>
</module>

I have also added a driver entry to the standalone.xml file as follows:

<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>
        <drivers>
            <driver name="h2" module="com.h2database.h2">
                <xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
            </driver>
            <driver name="mariadb" module="com.mariadb"/>
        </drivers>
    </datasources>
</subsystem>

Note that I have only included the driver entry for now. I will add the datasource entry after I get the module to load properly.

Now when I startup the server I get the following error:

14:14:46,570 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 26) JBAS014613: Operation ("add") failed - address: ([
    ("subsystem" => "datasources"),
    ("jdbc-driver" => "mariadb")
]) - failure description: "JBAS010441: Failed to load module for driver [com.mariadb]"

According to everything that I have read, this is the proper way to configure the driver, but it is not working for me. Does anyone know what I am doing wrong?

Thanks in advance for your help!


Solution

  • The first line of your module.xml has a typo (you use a colon instead of equals in xmlns=...):

    Your version: <module xmlns:"urn:jboss:module:1.1" name="com.mariadb">

    Correct version: <module xmlns="urn:jboss:module:1.3" name="com.mariadb">