9 Replies Latest reply on Mar 12, 2012 9:04 AM by colective

    java.sql.SQLException: No suitable driver found

    colective

      Hi,

       

      can somebody help me with this error.

      i tried to find by searching the net and still the same error.

       

      so, im trying to connect to oracle DB and i receive this error whe i try to post soap request

       

      2012-03-08 17:30:09,089 [http--10.243.181.252-8080-1] ERROR - [4FCB9F] RadiusSessionTable.getNewRadiusSessiontableEntry(): DB fault

      java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:Admin/pasw0rd@database:1639:TRADH

              at java.sql.DriverManager.getConnection(DriverManager.java:602)

              at java.sql.DriverManager.getConnection(DriverManager.java:185)

              at org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.java:75)

              at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)

              at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1188)

              at org.apache.commons.dbcp.PoolingDriver.connect(PoolingDriver.java:180)

              at java.sql.DriverManager.getConnection(DriverManager.java:582)

              at java.sql.DriverManager.getConnection(DriverManager.java:207)

       

      so, basically this url is constructed fine

      im using Class.forName

       

      Class.forName(jdbcClassName);

          String jdbcUrl;

          String jdbcUrl;

          if (props.getProperty(getKeyForProp(poolInstanceName, "jdbcUrl")) != null)

          {

            jdbcUrl = getValueForProp(props, poolInstanceName, "jdbcUrl");

          }

          else {

            checkExistence(props, getKeyForProp(poolInstanceName, "uid"));

            checkExistence(props, getKeyForProp(poolInstanceName, "passwd"));

            checkExistence(props, getKeyForProp(poolInstanceName, "host"));

            checkExistence(props, getKeyForProp(poolInstanceName, "port"));

            checkExistence(props, getKeyForProp(poolInstanceName, "sid"));

            String jdbcUrl;

            if (jdbcClassName.indexOf("mysql") != -1)

              jdbcUrl =

                "jdbc:mysql://" +

                getValueForProp(props, poolInstanceName, "host") +

                ":" +

                getValueForProp(props, poolInstanceName, "port") +

                "/" +

                getValueForProp(props, poolInstanceName, "sid") +

                "?" +

                "user=" +

                getValueForProp(props, poolInstanceName, "uid") +

                "&" +

                "password=" +

                getValueForProp(props, poolInstanceName, "passwd");

            else {

              jdbcUrl =

                "jdbc:oracle:thin:" +

                getValueForProp(props, poolInstanceName, "uid") +

                "/" +

                getValueForProp(props, poolInstanceName, "passwd") +

                "@" +

                getValueForProp(props, poolInstanceName, "host") +

                ":" +

                getValueForProp(props, poolInstanceName, "port") +

                ":" +

                getValueForProp(props, poolInstanceName, "sid");

            }

       

       

      it might be that this is classloading problem but i cannot find where.

      ist there any way to see loaded classes and from where are loaded

       

      my jboss-deployment-structure.xml is in attachment

       

       

      same code works on Websphere 7

       

      thank you

      tomislav

        • 1. Re: java.sql.SQLException: No suitable driver found
          david.salter

          Have you added the Oracle JDBC driver into your classpath?  If so, which one?

           

          Details for setting up AS 7 are here:

           

          https://community.jboss.org/wiki/DataSourceConfigurationInAS7

          • 2. Re: java.sql.SQLException: No suitable driver found
            colective

            yes, i added:

             

            lib/oracle/classes12.jar

            lib/oracle/aqapi.jar

            lib/oracle/orai18n.jar

             

            and

             

            lib/commons/commons-dbcp-1.4.jar

            lib/commons/commons-pool-1.6.jar

             

            in jboss-deployment-structure.xml as a module which referencing to war

             

                <module name="deployment.Business.ear.Oracle" >
                    <resources>
                        <resource-root path="lib/oracle/classes12.jar" >
                        </resource-root>
                    </resources>
                </module>

                <module name="deployment.Business.ear.commons-dbcp" >
                    <resources>
                        <resource-root path="lib/commons/commons-dbcp-1.4.jar" >
                        </resource-root>
                        <resource-root path="lib/commons/commons-pool-1.6.jar" >
                        </resource-root>
                    </resources>
                </module>

             

             

             

            • 3. Re: java.sql.SQLException: No suitable driver found
              david.salter

              classes12.jar is a very old driver meant for JDK 1.2 I believe.

               

              I'd recommend using a more modern drver such as ojdbc6.jar

              • 4. Re: java.sql.SQLException: No suitable driver found
                colective

                i will try in few min with latest driver but same jar works perfectly on Websphere..

                 

                i'll get back..

                 

                thanks

                • 5. Re: java.sql.SQLException: No suitable driver found
                  colective

                  same thing.

                   

                  i copied ojdbc6.jar to lib/oracle/

                   

                  i modified oracle module inside jboss-deployment-structure.xml

                  and error is the same..

                   

                  2012-03-08 18:50:05,343 [http--10.243.181.252-8080-1] ERROR - [7D9D8A] RadiusSessionTable.getNewRadiusSessiontableEntry(): DB fault

                  java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:Admin/pasw0rd@database:1639:TRADH

                          at java.sql.DriverManager.getConnection(DriverManager.java:602)

                          at java.sql.DriverManager.getConnection(DriverManager.java:185)

                          at org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.java:75)

                          at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)

                          at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1188)

                          at org.apache.commons.dbcp.PoolingDriver.connect(PoolingDriver.java:180)

                          at java.sql.DriverManager.getConnection(DriverManager.java:582)

                          at java.sql.DriverManager.getConnection(DriverManager.java:207)

                  • 6. Re: java.sql.SQLException: No suitable driver found
                    colective

                    Hi,

                     

                    enyone?

                     

                    thanks

                    t.

                    • 7. Re: java.sql.SQLException: No suitable driver found
                      wdfink

                      Could you post a bit more details?

                      Where do you pack/install the ojdbc and commons jar's?

                       

                      Do you check whether it works by installing in modules/...?

                      • 8. Re: java.sql.SQLException: No suitable driver found
                        david.salter

                        It looks like commons DBCP can't find your Oracle driver.  Do you have it added as a resource for the DBCP?

                        • 9. Re: java.sql.SQLException: No suitable driver found
                          colective

                           

                          you are the man..

                           

                           

                           

                          <module name="deployment.APP_B2B.ear.commons-dbcp" >

                               <resources>

                                      <resource-root path="lib/commons/commons-dbcp-1.4.jar" >

                                      </resource-root>

                                      <resource-root path="lib/commons/commons-pool-1.6.jar" >

                                      </resource-root>

                                      <resource-root path="lib/oracle/classes12.jar" >

                                      </resource-root>

                                  </resources>

                              </module>

                           

                          thank you

                          t.