title: Db2 Driver/Datasource setup on wildfly: Failed to load module for driver [com.ibm]
body: <p>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.</p>
  
  <p>My research tells me this is a two step process</p>
  
  <ol>
  <li>install the drivers as a module in the %JBOSS_HOME%/modules/com/ibm/main dir.</li>
  <li>configure the datasources subsystem to include this module as a driver in your connection settings.</li>
  </ol>
  
  <p>So far I have installed the module under the following structure with the following module.xml:</p>
  
  <pre><code>modules/
  `-- com/
      `-- ibm/
          `-- main/
              |-- db2jcc4.jar
              |-- db2jcc_license_cu.jar
              |-- db2jcc_license_cisuz.jar
              `-- module.xml
  
  &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;module xmlns="urn:jboss:module:1.3" name="com.ibm"&gt;
      &lt;resources&gt;
          &lt;resource-root path="db2jcc4.jar"/&gt;
          &lt;resource-root path="db2jcc_license_cu.jar"/&gt;
          &lt;resource-root path="db2jcc_license_cisuz.jar"/&gt;
      &lt;/resources&gt;
      &lt;dependencies&gt;
          &lt;module name="javax.api"/&gt;
          &lt;module name="javax.transaction.api"/&gt;
          &lt;module name="sun.jdk"/&gt;
      &lt;/dependencies&gt;
  &lt;/module&gt;
  </code></pre>
  
  <p>There is no space before the <code>&lt;?...?&gt;</code> in the xml file. the module name is "com.ibm" and the datasource is as follows:</p>
  
  <pre><code>&lt;subsystem xmlns="urn:jboss:domain:datasources:2.0"&gt;
      &lt;datasources&gt;
          &lt;datasource jndi-name="java:/jdbc/MyDS" pool-name="MyDS" enabled="true" use-java-context="true"&gt;
              &lt;xa-datasource-property name="ServerName"&gt;myIP&lt;/xa-datasource-property&gt;
              &lt;xa-datasource-property name="PortNumber"&gt;1234&lt;/xa-datasource-property&gt;
              &lt;xa-datasource-property name="DatabaseName"&gt;MyDB&lt;/xa-datasource-property&gt;
              &lt;xa-datasource-property name="DriverType"&gt;4&lt;/xa-datasource-property&gt;
              &lt;driver&gt;ibmdb2&lt;/driver&gt;
              &lt;pool&gt;
                  &lt;min-pool-size&gt;0&lt;/min-pool-size&gt;
                  &lt;max-pool-size&gt;50&lt;/max-pool-size&gt;
              &lt;/pool&gt;
              &lt;security&gt;
                  &lt;user-name&gt;bob&lt;/user-name&gt;
                  &lt;password&gt;isyouruncle&lt;/password&gt;
              &lt;/security&gt;
              &lt;validation&gt;
                  &lt;valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.db2.DB2ValidConnectionChecker"/&gt;
                  &lt;stale-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.db2.DB2StaleConnectionChecker"/&gt;
                  &lt;exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.db2.DB2ExceptionSorter"/&gt;
              &lt;/validation&gt;
          &lt;/datasource&gt;
          &lt;drivers&gt;
              &lt;driver name="ibmdb2" module="com.ibm"&gt;
                  &lt;xa-datasource-class&gt;com.ibm.db2.jcc.DB2XADatasource&lt;/xa-datasource-class&gt;
              &lt;/driver&gt;
          &lt;/drivers&gt;
      &lt;/datasources&gt;
  &lt;/subsystem&gt;
  </code></pre>
  
  <p>The loading up of the server produces this error:</p>
  
  <pre><code>12:49:01,228 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 9) JBAS014613: Operation ("add") failed - address: ([
      ("subsystem" =&gt; "datasources"),
      ("jdbc-driver" =&gt; "ibmdb2")
  ]) - failure description: "JBAS010441: Failed to load module for driver [com.ibm]"
  </code></pre>
  
  <p>Which in turn causes my datasource declaration to fail loading as the driver is missing.</p>
  
  <p>I am using <a href="https://community.jboss.org/thread/202025?_sscc=t" rel="nofollow noreferrer">older documentation</a> as a guide because there doesn't seem to be any available for wildfly as yet. <a href="https://stackoverflow.com/questions/3988059/creating-xa-datasource-to-db2-on-jboss">this documentation</a> 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.</p>
  
  <p>I want to connect to <strong>DB2 9.7</strong>.</p>
  
  <p>Please and thank you.</p>