7

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.

Community
  • 1
  • 1
coderatchet
  • 8,120
  • 17
  • 69
  • 125

6 Answers6

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!

Adler
  • 11
  • 2
  • I made the change, however I am still getting the message :( – coderatchet Jul 29 '14 at 01:34
  • 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? – Adler Aug 05 '14 at 02:03
  • There were some bug on Wildfly 8.0, have you switch to wildfly 8.1? There is a documentation : https://docs.jboss.org/author/display/WFLY8/Developer+Guide#DeveloperGuide-Definethedatasource . Replace with your ibm driver. – Adler Aug 05 '14 at 12:45
  • unfortunately I am using Wildfly 8.1 :(, also my configuration is correct according to the documentation. – coderatchet Aug 06 '14 at 04:05
  • 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. – Adler Aug 08 '14 at 22:47
  • bummer. Maybe I'm missing something fundamental. I'll look into it and get back to you :). – coderatchet Aug 11 '14 at 00:05
1

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.

geert3
  • 7,086
  • 1
  • 33
  • 49
  • 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. – ArtOfWarfare Feb 12 '16 at 20:31
1

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.

starsplusplus
  • 1,232
  • 3
  • 19
  • 32
1

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.

Angelo Fuchs
  • 9,825
  • 1
  • 35
  • 72
0

jar files in module main folder should be added to the module.xml as

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

If you're using db2jcc.jar and not db2jcc4.jar and as you're defining a standard (non-XA) datasource, perhaps it helps to spedicfy the driver class too.

<driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>
Shalika
  • 1,457
  • 2
  • 19
  • 38
0

Everything is correct, just make s capital for (DB2XADatasource) as below:

<xa-datasource-class>com.ibm.db2.jcc.DB2XADataSource</xa-datasource-class>
ashutosh
  • 405
  • 6
  • 10