Wrong Driver Class - Is this a JBoss 7 bug?
foutjo Feb 14, 2012 7:24 AMHad this posted in the datasource forum but no replies.
Can one of the JBoss 7 experts take a look at the following and tell me if this could be a JBoss 7 bug?
Trying to get db2 univeral type 4 driver to work with jboss 7.1.0.CR1b.
Setup db2 driver as a module. Seems to setup fine but when a sample program tries to do
a connection I get the following:
Caused by: javax.resource.ResourceException: Wrong driver class [class com.ibm.db2.jcc.DB2Driver] for this connection URL [jdbc:db2//10.90.10.125/apdev70:60009]
at org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getLocalManagedConnection(LocalManagedConnectionFactory.java:251)
---------------------------------------------------------------------------
DB2 Version 8.1.8 fix pack 8 (db2 server)
Used jar files from IBM/SQLLIB/java
db2jcc - version 2.5
--------------------------------------------------------------------------
Running Windows 7 64 bit
-------------------------------------------------------------------------
Setup db2 driver as module:
modules/com/ibm/db2/main/db2jcc.jar
/db2jcc_license_cu
Created module.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ This file will define the DB2 database driver and any
~ dependencies.
-->
<module xmlns="urn:jboss:module:1.1" name="com.ibm.db2">
<resources>
<resource-root path="db2jcc.jar"/>
<resource-root path="db2jcc_license_cu.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="sun.jdk"/>
</dependencies>
</module>
-----------------------------------------------------------------------------------
Verifed database IP/Port/Name
10.90.10.125
60009
apdev70
------------------------------------------------------------------------------------
Added db2 datasource to standalone.xml
<datasources> | |
<datasource jndi-name="java:/admindatasource" pool-name="admindatasource" enabled="true" jta="true" use-java-context="true" use-ccm="true"> | |
<connection-url> | |
jdbc:db2//10.90.10.125/apdev70:60009 | |
</connection-url> | |
<driver> | |
db2jcc | |
</driver> | |
<timeout> | |
<idle-timeout-minutes> | |
0 | |
</idle-timeout-minutes> | |
<query-timeout> | |
600 | |
</query-timeout> | |
</timeout> | |
</datasource> | |
<drivers> | |
<driver name="db2jcc" module="com.ibm.db2"> | |
<driver-class> | |
com.ibm.db2.jcc.DB2Driver | |
</driver-class> | |
</driver> | |
</drivers> | |
</datasources> |
--------------------------------------------------------------------------------------------------------
Java code connection:
InitialContext ic = new InitialContext();
DataSource ds = (DataSource)ic.lookup("java:/admindatasource");
Connection con = ds.getConnection();
_____________________________________________________________
When starting standalone server get the following log messages:
(See that the db2 driver is deployed and that the "admindatsource" is Bound
13:00:15,404 INFO [org.jboss.as.connector.subsystems.datasources] (ServerService Thread Pool -- 26) JBAS010403: Deploying JDBC-compliant driver class com.ibm.db2.jcc.DB2Driver (version 2.5)
13:00:15,430 INFO [org.jboss.as.remoting] (MSC service thread 1-5) Listening on /10.100.100.12:4447
13:00:15,932 INFO [org.jboss.as.remoting] (MSC service thread 1-6) Listening on /10.100.100.12:9999
13:00:15,969 INFO [org.jboss.as.server.deployment.scanner] (MSC service thread 1-1) JBAS015012: Started FileSystemDeploymentService for directory C:\apps\jboss-as-7.1.0.CR1b\standalone\deployments
13:00:16,388 INFO [org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-2) JBAS010400: Bound data source [java:/admindatasource]
------------------------------------------------------------------------------------------------------
I read the doc on classloading issues several times and it seems that I have everythings setup the way that JBoss wants.
So does anyone have any ideas on why I might be getting this error?
Any help is greatly appreciated.
Thanks.