1 2 Previous Next 16 Replies Latest reply on Mar 21, 2016 9:38 AM by xiaomutoun

    NestedSQLException: Apparently wrong driver class specified

    wyzhao

      Hi, all,



      I am trying to add a data source in JBoss 3.2.1 to access MS SQL Server 2000 using Microsoft JDBC driver. Here is the data source configuration file:



      <?xml version="1.0" encoding="UTF-8"?>





      <local-tx-datasource>

      <jndi-name>jdbc/tpmPool</jndi-name>

      <connection-url>jdbc:sybase:Tds:host1:5000/TPMQA1?JCONNECT_VERSION=5</connection-url>

      <driver-class>com.sybase.jdbc2.jdbc.SybDriver</driver-class>

      <user-name>userName1</user-name>

      password

      <min-pool-size>10</min-pool-size>

      <max-pool-size>100</max-pool-size>

      </local-tx-datasource>



      <!-- newly added-->

      <local-tx-datasource>

      <jndi-name>jdbc/cdoStagingPool</jndi-name>

      <connection-url>jdbc:microsoft:sqlserver://host2:1433;DatabaseName=Dev_CDOStaging</connection-url>

      <driver-class>com.microsoft.jdbc.sqlserver.SQLServerDriver</driver-class>

      <user-name>userName1</user-name>

      password

      </local-tx-datasource>





      When the app accesses the MSSQL database for the first time, it throws the following exception:



      2005-02-28 14:35:53,475 ERROR [STDERR] org.jboss.util.NestedSQLException: Apparently wrong driver class specified for URL: class: com.microsoft.jdbc.sqlserver.SQLServerDriver, url: jdbc:microsoft:sqlserver://sf1-prd-cg-db5:1433;DatabaseName=Dev_CDOStaging; - nested throwable: (org.jboss.resource.JBossResourceException: Apparently wrong driver class specified for URL: class: com.microsoft.jdbc.sqlserver.SQLServerDriver, url: jdbc:microsoft:sqlserver://sf1-prd-cg-db5:1433;DatabaseName=Dev_CDOStaging)

      2005-02-28 14:35:53,475 ERROR [STDERR] at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:106)
      ......


      The second time when the Java code is accessed, it works.



      Does anyone know what is wrong? Please enlighten me.





      Thanks

        • 1. Re: NestedSQLException: Apparently wrong driver class specif

          It means the driver-class/url are incompatible.

          I've also seen this problem when there is an internal problem within the driver,
          e.g. classes missing or other bizarre internal error.

          • 2. Re: NestedSQLException: Apparently wrong driver class specif
            chirayath

            Hi,
            Put the proper driver jar file in server/default/lib folder of JBoss installation folder.

            Regards,
            Joby

            • 3. Re: NestedSQLException: Apparently wrong driver class specif
              bhavinpmehta

              Even I face the same problem

              • 4. Re: NestedSQLException: Apparently wrong driver class specif
                bhavinpmehta

                I am also getting the same problem, however , be it the first or the second Time I keep on getting The above error(Apparent wrong driver)

                In my case if I connect Directly using DriverManager.getConnection() , then I am able to connect to the DataBase, but when i try using Connection Pooling i.e ds.xml and then Look up, I get this error.
                I use following url in ds.xml,
                <connection-url>jdbc:microsoft:sqlserver://servername:1433;DatabaseName=dbname;User=uname;Password=pwder</connection-url>
                Plese let me know if this is correct or not. I use following jars
                1.msbase.jar
                2.mssqlserver.jar
                3.msutil.jar

                • 5. Re: NestedSQLException: Apparently wrong driver class specif
                  bhavinpmehta

                  Hi All,
                  My Problem is finally resolved. I switched over to jtds drivers (freeware) . I wasted 3 days trying with Microsoft Drivers and it Took only 5 mins for Connection Pooling using jtds drivers.

                  • 6. Re: NestedSQLException: Apparently wrong driver class specif
                    pakemann

                    I was having the same problem and also switched to jtds, but the problem remains.

                    My connection is failing randomly with "Apparently wrong driver class specified for URL" error.

                    The connection will fail this way over and over again, then will randomly begin to work. It's maddening! Is anyone else experiencing this?

                    I am running JBoss on Java 1.506, conncting to MSSQL with jtds 1.2 with the folloding datasource specifier:




                    <local-tx-datasource>
                    <jndi-name>MSSQLDS</jndi-name>
                    <connection-url>jdbc:jtds:sqlserver://192.168.100.100:1433/CADB;tds=8.0;lastupdatecount=true</connection-url>
                    <driver-class>net.sourceforge.jtds.jdbc.Driver</driver-class>
                    <user-name>username</user-name>
                    pwd
                    <!--
                    sql to call on an existing pooled connection when it is obtained from pool
                    -->
                    <check-valid-connection-sql>SELECT 1</check-valid-connection-sql>
                    </local-tx-datasource>


                    • 7. Re: NestedSQLException: Apparently wrong driver class specif
                      weston.price

                      How are you deploying your datasource? Are any of the JDBC jars contained in the lib directory or your WAR? Do any of the JDBC jar files reside in an EAR?

                      Typically we see this error when a user tries to deploy the jars inside of an application archive and not in the server/server-config/lib directory.

                      • 8. Re: NestedSQLException: Apparently wrong driver class specif
                        pakemann

                        Wow, that was a swift response! Turnaround time of 4 minutes - ought to be in an ad for JBoss....

                        Indeed, the jar file was being deployed in the WAR module. I removed it from the WAR and put in in the config/lib directory as specified, and it now seems to be working reliably.

                        Thank you very much for your help.

                        • 9. Re: NestedSQLException: Apparently wrong driver class specif
                          weston.price

                          Not a problem :-)

                          Note, this is a bug in the DriverManager. Basically what is going on is some heinous cacheing of classes that prevents the class from being loaded. Supposedly this is addressed in JDBC 4.0. Also, the Class.forName("classname") mess goes away. The DriverManager will be able to load the classes automatically without the registration process.

                          Regards.


                          • 10. Re: NestedSQLException: Apparently wrong driver class specif
                            lal_praveen

                            I am getting this same error. My ear does'nt contain any jdbc.jar files.
                            Configuration is:jdk1.6.0_03, jboss-4.2.2.GA, MySQL version 5.0.45, MySQL driver
                            C:\jboss-4.2.2.GA\server\default\lib\mysql-connector-java-5.1.5-bin.jar

                            Though I am seeing C:\jboss-4.2.2.GA\server\default\tmp\deploy\tmp29174jboss-local-jdbc.rar-contents\jboss-local-jdbc.jar
                            file in tmp folder. Probably it is used by jboss. I am deploying ear in default server config.

                            04:23:10,942 INFO [InjectedDataSourceConnectionProvider] Using provided datasource
                            04:23:10,957 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: com.mysql.jdbc.Driver, url: jdbc:mysql//127.0.0.1:3306/Testworld)
                            at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.createManagedConnection(LocalManagedConnectionFactory.java:179)
                            at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.createConnectionEventListener(InternalManagedConnectionPool.java:577)
                            at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:262)
                            at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:500)
                            at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:341)
                            at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:315)
                            at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:396)
                            at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:842)

                            • 11. Re: NestedSQLException: Apparently wrong driver class specif
                              vickyk

                              Explain all the steps you have been doing , open a new thread I will address it there .
                              Your post does not clearly indicate how you are deploying the datasource , explain things in DETAIL and *NEVER* bloat the existing forum thread as it becomes difficult for people to indentify the current issue .

                              • 12. Re: NestedSQLException: Apparently wrong driver class specif
                                lal_praveen

                                Sorry My Bad.
                                I was not giving correct jdbc url. IO missed : after mysql in url
                                BAD jdbc:mysql//127.0.0.1:3306/Testworld
                                Correct jdbc:mysql://127.0.0.1:3306/Testworld

                                • 13. Re: NestedSQLException: Apparently wrong driver class specif
                                  crowse

                                  In case anyone can get anything useful, I have an ear file that works well and very reliably (over 6 months) on my Linux server running JB 4.2.1.

                                  This ear uses MS sql drivers and connects to MS SQL on mt 2003 SBS server.

                                  When I move THE SAME distros of Java, JBoss, MS SQL drivers ear etc to the 2003 server running as localhost ... or to a DNS name or IP number on the WIn server , I get this message.

                                  Theenvironments couldnt be more similar other than the one is Unix, the other WIn2003.

                                  I'm about to check for copies of the drivers in the ear - they will, of course, be from the SAME DOWNLOAD from MS.

                                  Chris

                                  • 14. Re: NestedSQLException: Apparently wrong driver class specif
                                    dagger33

                                    I've been having the same problem.

                                    bhavinpmehta's advice solved the problem - so there must definitely be something wrong with some of Microsoft's JDBC drivers somewhere as I'm sure all the connection strings and things were right... *shrug*

                                    This was with version 2.0.1008.2 of the Microsoft SQL Server 2005 driver.

                                    1 2 Previous Next