1 Reply Latest reply: Feb 14, 2012 7:48 AM by Joseph Fouts RSS

Wrong driver class [class comm.ibm.db2.jcc.db2Driver]

Joseph Fouts Novice

Trying to get db2 univeral type 4 driver to work with jboss 7.1 and keep getting :

 

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

Used jar files from IBM/SQLLIB/java

 

--------------------------------------------------------------------------

 

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.11)

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]

 

 

------------------------------------------------------------------------------------------------------

 

So any ideas on why I am getting the following error when trying to make a connection?

 

Any help is greatly appreciated.

 

Thanks.