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
- install the drivers as a module in the %JBOSS_HOME%/modules/com/ibm/main dir.
- 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.
I had the same issue. I resolved it by removing these two lines from module.xml:
I don't have a specific explanation as to why this worked.
jar files in module main folder should be added to the module.xml as
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.
You could try to enable
jboss.jdbc.spy
=TRACE
and addspy="true"
to the datasource.and
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
withouts
.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!
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
andstandalone-full.xml
. In both cases the module name was given ascom.ibm.main
, but it should have beencom.ibm
.So in short: If you encounter this message and double checking the config files doesn't help, rewrite them.