0

I am getting the following exception while getting datasource through jndi:

Caused by: org.springframework.jdbc.CannotGetJdbcConnectionException:
     Could not get JDBC Connection; nested exception is
     org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null

Tomcat's server.xml :

     <Resource name="jdbc/testdb" auth="Container" type="javax.sql.DataSource"
          username="test" password="test1234"
          url="*********"
          driverClass="oracle.jdbc.driver.OracleDriver"
          initialSize="5" maxWait="5000"
          maxActive="120" maxIdle="5"
          validationQuery="select 1"
          poolPreparedStatements="true"/>    

Tomcat's Context.xml :

<ResourceLink name="jdbc/testdb" global="jdbc/testdb"
type="javax.sql.DataSource" />     

Spring's servlet xml :

<jee:jndi-lookup id="dataSource" jndi-name="jdbc/testdb"  resource-ref="true" />

and final Web.xml :

   <resource-ref>
       <description>Resource reference to database</description>
       <res-ref-name>jdbc/testdb</res-ref-name>
       <res-type>javax.sql.DataSource</res-type>
       <res-auth>Container</res-auth>
       <res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>

Could somebody please help me?

Error Stack trace :

  Error querying database.  Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'
5
  • 1
    Please provide the complete stacktrace. Commented Feb 13, 2015 at 7:15
  • 1
    Did you actually write the url ********** there? Or are you trying to hide the URL from us? Because it appears that the URL is the problem. Commented Feb 13, 2015 at 7:21
  • @RealSkeptic : I am writing actual url there but I am hiding here . Commented Feb 13, 2015 at 8:23
  • @LuiggiMendoza : added stacktrace. Commented Feb 13, 2015 at 8:52
  • And the actual URL is? Appears to be empty to me. Commented Feb 17, 2024 at 22:18

1 Answer 1

0

Try driverClassName instead of driverClass:

driverClassName="oracle.jdbc.driver.OracleDriver"
Sign up to request clarification or add additional context in comments.

1 Comment

I tried with driverClassName but getting same error.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.