DB2 datasource (non-XA) working for JBoss AS 7.1.1
heyyou Jul 2, 2012 1:10 PMHello,
Hoping someone might has some insight how I can get my DB2 datasource (non-XA !!) working on JBoss AS 7.1.1
Environment:
RHEL 5.7
JBoss 7.1.1-Final
DB2 JDBC (non-xa)
Configuration:
# ls $JBOSS_HOME/modules/com/ibm/db2/main
db2jcc.jar
db2jcc.jar.index
db2jcc_license_cu.jar
db2jcc_license_cu.jar.index
module.xml
# cat $JBOSS_HOME/modules/com/ibm/db2/main/module.xml
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.0" name="com.ibm.db2">
<resources>
<resource-root path="db2jcc.jar"/>
<resource-root path="db2jcc_license_cu.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
</dependencies>
</module>
# vi $JBOSS_HOME/standalone/configuration/standalone.xml
<datasources>
<datasource jndi-name="java:jboss/datasources/MyDbDataSource" pool-name="java:jboss/datasources/MyDbDataSource-pool" enabled="true" use-java-context="true">
<connection-url>jdbc:db2:/myip:50000/MyDb</connection-url>
<driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>
<driver>db2</driver>
<security>
<user-name>db2inst1</user-name>
<password>XXXXXXXXX</password>
</security>
</datasource>
<drivers>
<driver name="db2" module="com.ibm.db2">
<driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>
</driver>
</drivers>
</datasources>
Problem:
When I start JBoss AS server, I get the following messages:
# bin/standalone.sh
...
05:59:20,205 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 27) Operation ("add") failed - address: ([
("subsystem" => "datasources"),
("jdbc-driver" => "db2")
]) - failure description: "JBAS010434: Unable to instantiate driver class \"com.ibm.db2.jcc.DB2Driver\". See log (WARN) for more details"
...
...
05:59:22,342 INFO [org.jboss.as.controller] (Controller Boot Thread) JBAS014774: Service status report
JBAS014775: New missing/unsatisfied dependencies:
service jboss.jdbc-driver.db2 (missing) dependents: [service jboss.data-source.java:jboss/datasources/TradeDataSource]
For some reason, it is unable to find the drivers and it has this message about a missing/unsatisfiied dependency.
I've gone through the documentation, forums, etc and not finding much on these errors. I found one reference
that mentioned to make sure there are no blank lines at the top of the module.xml but that was not my issue.
I also attempted the following:
1. Copy the db2*.jar to $JBOSS_HOME/standalone/deployments
2. Change standalone.xml to:
<datasources>
<datasource jndi-name="java:jboss/datasources/MyDbDataSource" pool-name="java:jboss/datasources/MyDbDataSource-pool" enabled="true" use-java-context="true">
<connection-url>jdbc:db2:/myip:50000/MyDb</connection-url>
<driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>
<driver>db2</driver>
<security>
<user-name>db2inst1</user-name>
<password>XXXXXXXXX</password>
</security>
</datasource>
<drivers>
<driver name="db2">
<driver-class>com.ibm.db2.jcc.DB2Driver</driver-class>
</driver>
</drivers>
</datasources>
When I do this, it removes the noclassfound error and I continue to get the "new/missing dependency" error.
Even thought I know the there is an issue, I did try to verify the datasource using:
# $JBOSS_HOME/bin/jboss-cli.sh
> connect
> /subsystem=datasources/datasource=java\:jboss\/datasources\/MyDbDataSource:test-connection-in-pool
{
"outcome" => "failed",
"failure-description" => "JBAS014739: No handler for test-connection-in-pool at address [
(\"subsystem\" => \"datasources\"),
(\"datasource\" => \"java:jboss/datasources/MyDbDataSource\")
]",
"rolled-back" => true
}
Does anyone have DB2 (non-xa) configuration working for JBoss AS 7?
Thanks in advance!