5 Replies Latest reply on Dec 13, 2006 11:11 AM by Victor Gluschenko

    Jboss Oracle DS : Error wrong drivers

    Benjamin Cuthbert Newbie

      All i have copied my classes12.zip and ojdbc.jar into the default/server/lib directory restart my jboss and tried to setup an oracle connection in my MDB bean as follows

       DataSource ds = (javax.sql.DataSource) ic.lookup("java:OracleDS");
       oraCon = ds.getConnection();
       logger.info("Initializing Oracle Datasource Connection.");
      


      But when i send in a message and try and connect to the DS i get this error.

      12:11:32,280 WARN [JBossManagedConnectionPool] Throwable while attempting to get a new connection: null
      org.jboss.resource.JBossResourceException: Could not create connection; - nested throwable: (org.jboss.resource.JBossResourceException: Apparently wrong driver class specified for URL: class: oracle.jdbc.driver.OracleDriver, url: jdbc:gfmisapp:GrandSlam05:@10.142.204.76:1521:GFMIS)
       at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:179)
       at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:565)
       at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:250)
       at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:491)
       at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:341)
       at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:301)
       at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:396)
       at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)
       at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:88)
      


      The libs were copied from my Oracle installation jdbc/lib directory

        • 1. Re: Jboss Oracle DS : Error wrong drivers
          Weston M. Price Master

          Please post your *-ds.xml file. Also, make sure that the jdbc.jar files that are in your server/lib directory are the *only* Jar files. Also, you don't need both the zip and the jar. Just use the ojdbc14.jar file and remove the classes.zip.

          • 2. Re: Jboss Oracle DS : Error wrong drivers
            Benjamin Cuthbert Newbie

            I used the standard oracle-ds.xml from the example/jca

            <datasources>
             <local-tx-datasource>
             <jndi-name>OracleDS</jndi-name>
             <connection-url>jdbc:oracle:thin:@youroraclehost:1521:yoursid</connection-url>
             <!--
            
             Here are a couple of the possible OCI configurations.
             For more information, see http://otn.oracle.com/docs/products/oracle9i/doc_library/release2/java.920/a96654/toc.htm
            
             <connection-url>jdbc:oracle:oci:@youroracle-tns-name</connection-url>
             or
             <connection-url>jdbc:oracle:oci:@(description=(address=(host=youroraclehost)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME=yourservicename)))</connection-url>
            
             Clearly, its better to have TNS set up properly.
             -->
             <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
             <user-name>x</user-name>
             <password>y</password>
             <!-- Uses the pingDatabase method to check a connection is still valid before handing it out from the pool -->
             <!--valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleValidConnectionChecker</valid-connection-checker-class-name-->
             <!-- Checks the Oracle error codes and messages for fatal errors -->
             <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
             <!-- sql to call when connection is created
             <new-connection-sql>some arbitrary sql</new-connection-sql>
             -->
            
             <!-- sql to call on an existing pooled connection when it is obtained from pool - the OracleValidConnectionChecker is prefered
             <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>
             -->
            
             <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
             <metadata>
             <type-mapping>Oracle9i</type-mapping>
             </metadata>
             </local-tx-datasource>
            
            </datasources
            
            
            Changing the values, i do however have the .zip and the .jar in the server/lib directory.
            


            • 3. Re: Jboss Oracle DS : Error wrong drivers
              Victor Gluschenko Newbie

              I have same problem. But second and later tries are successful.
              I guess there is problem to detect if Oracle jdbc driver is loaded.

              org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.isDriverLoadedForURL(String url)


              • 4. Re: Jboss Oracle DS : Error wrong drivers
                Weston M. Price Master

                This generally happens when you have your JDBC driver jar files inside another deployable unit (WAR, EAR) and not in server/lib. It is a ClassLoader issue with the DriverManager in the VM, not in JBossAS.

                • 5. Re: Jboss Oracle DS : Error wrong drivers
                  Victor Gluschenko Newbie

                  Thanks for replay. I think so.
                  For information: I've rewrited my-ds.xml to use xa-datasource with oracle, it's work without exceptions now.