Db2 Driver/Datasource setup on wildfly: Failed to load module for driver [com.ibm]

13,437

Solution 1

try replacing :

<resources-root path="db2jcc4.jar"/> <resources-root path="db2jcc_license_cu.jar"/> <resources-root path="db2jcc_license_cisuz.jar"/>

by

<resource-root path="db2jcc4.jar"/> <resource-root path="db2jcc_license_cu.jar"/> <resource-root path="db2jcc_license_cisuz.jar"/>

Remove the s from resources-route!

Solution 2

I had the same issue. I resolved it by removing these two lines from module.xml:

<resource-root path="db2jcc_license_cu.jar"/>
<resource-root path="db2jcc_license_cisuz.jar"/>

I don't have a specific explanation as to why this worked.

Solution 3

You could try to enable jboss.jdbc.spy = TRACE and add spy="true" to the datasource.

<datasource jndi-name="..." ... spy="true">

and

<logger category="jboss.jdbc.spy">
  <level name="TRACE"/>
</logger>

This is normally to debug the JDBC, but perhaps it shows more on the loading of the driver as well. Also you definitely need the resource-root without s.

Solution 4

This is not the solution to your problem but a reference for future visitors who (like me) come to this question by search of the same error message:

Today I had the same problem, for me it was an error in module.xml and standalone-full.xml. In both cases the module name was given as com.ibm.main, but it should have been com.ibm.

So in short: If you encounter this message and double checking the config files doesn't help, rewrite them.

Share:
13,437
coderatchet
Author by

coderatchet

"having a bad day? ok then. I'm hear to he..... LOOK A SQUIRREL" - Albert Einstein, probably... maybe.

Updated on June 24, 2022

Comments

  • coderatchet
    coderatchet almost 2 years

    I am wanting to configure the data source for db2 on my wildfly server (Wildfly.8.0.0-Final and 8.1.0 as well.) and am running into some problems doing so.

    My research tells me this is a two step process

    1. install the drivers as a module in the %JBOSS_HOME%/modules/com/ibm/main dir.
    2. configure the datasources subsystem to include this module as a driver in your connection settings.

    So far I have installed the module under the following structure with the following module.xml:

    modules/
    `-- com/
        `-- ibm/
            `-- main/
                |-- db2jcc4.jar
                |-- db2jcc_license_cu.jar
                |-- db2jcc_license_cisuz.jar
                `-- module.xml
    
    <?xml version="1.0" encoding="UTF-8"?>
    <module xmlns="urn:jboss:module:1.3" name="com.ibm">
        <resources>
            <resource-root path="db2jcc4.jar"/>
            <resource-root path="db2jcc_license_cu.jar"/>
            <resource-root path="db2jcc_license_cisuz.jar"/>
        </resources>
        <dependencies>
            <module name="javax.api"/>
            <module name="javax.transaction.api"/>
            <module name="sun.jdk"/>
        </dependencies>
    </module>
    

    There is no space before the <?...?> in the xml file. the module name is "com.ibm" and the datasource is as follows:

    <subsystem xmlns="urn:jboss:domain:datasources:2.0">
        <datasources>
            <datasource jndi-name="java:/jdbc/MyDS" pool-name="MyDS" enabled="true" use-java-context="true">
                <xa-datasource-property name="ServerName">myIP</xa-datasource-property>
                <xa-datasource-property name="PortNumber">1234</xa-datasource-property>
                <xa-datasource-property name="DatabaseName">MyDB</xa-datasource-property>
                <xa-datasource-property name="DriverType">4</xa-datasource-property>
                <driver>ibmdb2</driver>
                <pool>
                    <min-pool-size>0</min-pool-size>
                    <max-pool-size>50</max-pool-size>
                </pool>
                <security>
                    <user-name>bob</user-name>
                    <password>isyouruncle</password>
                </security>
                <validation>
                    <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.db2.DB2ValidConnectionChecker"/>
                    <stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.db2.DB2StaleConnectionChecker"/>
                    <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.db2.DB2ExceptionSorter"/>
                </validation>
            </datasource>
            <drivers>
                <driver name="ibmdb2" module="com.ibm">
                    <xa-datasource-class>com.ibm.db2.jcc.DB2XADatasource</xa-datasource-class>
                </driver>
            </drivers>
        </datasources>
    </subsystem>
    

    The loading up of the server produces this error:

    12:49:01,228 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 9) JBAS014613: Operation ("add") failed - address: ([
        ("subsystem" => "datasources"),
        ("jdbc-driver" => "ibmdb2")
    ]) - failure description: "JBAS010441: Failed to load module for driver [com.ibm]"
    

    Which in turn causes my datasource declaration to fail loading as the driver is missing.

    I am using older documentation as a guide because there doesn't seem to be any available for wildfly as yet. this documentation shows some promise but it seems a little out of date. If anyone has had any experience setting this up then Your help would be much appreciated.

    I want to connect to DB2 9.7.

    Please and thank you.

  • coderatchet
    coderatchet almost 10 years
    I made the change, however I am still getting the message :(
  • Admin
    Admin over 9 years
    Sorry to have taken much time to come back to you? Have you solved this issue? If not please give me some more information. What IDE are you using (the solution could be with the plugin configuration?
  • Admin
    Admin over 9 years
    There were some bug on Wildfly 8.0, have you switch to wildfly 8.1? There is a documentation : docs.jboss.org/author/display/WFLY8/… . Replace with your ibm driver.
  • coderatchet
    coderatchet over 9 years
    unfortunately I am using Wildfly 8.1 :(, also my configuration is correct according to the documentation.
  • Admin
    Admin over 9 years
    According to your post, everything is correct. I can't see any reason why it doesn't work. The message means that it does not find the module. I have MySQL configured just like this (without the sun.jdk module) and it's working right now. Look to se if sun.jdk module is present. also make sure the standalone.bat, standalone.xml (or domain) are under the same %JBOSS_HOME%. I cannot see any other reason for this not to work properly.
  • coderatchet
    coderatchet over 9 years
    bummer. Maybe I'm missing something fundamental. I'll look into it and get back to you :).
  • Nitek
    Nitek over 8 years
    Worked for me as well
  • ArtOfWarfare
    ArtOfWarfare about 8 years
    I tried this but it doesn't appear to have yielded any new debug information... I see no TRACE or DEBUG messages in my logs, still just the same INFO and ERROR messages as always.
  • Nicolas C
    Nicolas C almost 7 years
    that's it! I had com.ibm.db2, in standalone.xml, but the module was in com.ibm