Results 1 to 5 of 5

Thread: oracle JDBC throws error while initializing

  1. #1

    Default oracle JDBC throws error while initializing

    Hello everyone ,

    This is how my config file looks like

    <!-- DB CONNECTION TO A ORACLE DATABASE -->
    <bean id="dataSourceORACLE" class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName"><value>oracle.jdbc.driver.O racleDriver</value></property>
    <property name="url"><value>jdbc:oracle:thin:@someip:1521:SI D</value></property>
    <property name="username"><value>username</value></property>
    <property name="password"><value>password</value></property>
    </bean>

    And my JdbcTemplate uses it ,

    <!-- Init a JdbcTemplate bean with the specific DataSource -->
    <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate" >
    <property name="dataSource"><ref local="dataSourceORACLE" /></property>
    </bean>


    But when i compile my code in the logs i get the following

    2005-04-05 08:37:13,486 DEBUG [org.springframework.jdbc.datasource.DataSourceUtil s] - <Opening JDBC connection>
    2005-04-05 08:37:13,490 WARN [org.springframework.jdbc.support.SQLErrorCodesFact ory] - <Error while extracting database product name - falling back to empty error codes>
    org.springframework.jdbc.support.MetaDataAccessExc eption: Could not get Connection for extracting meta data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionEx ception: Could not get JDBC connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.driver.OracleDriver'
    org.springframework.jdbc.CannotGetJdbcConnectionEx ception: Could not get JDBC connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.driver.OracleDriver'
    org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'oracle.jdbc.driver.OracleDriver', cause:
    java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    at org.apache.catalina.loader.StandardClassLoader.loa dClass(StandardClassLoader.java:945)
    at org.apache.catalina.loader.StandardClassLoader.loa dClass(StandardClassLoader.java:810)
    at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:302)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:141)
    at org.apache.commons.dbcp.BasicDataSource.createData Source(BasicDataSource.java:730)
    at org.apache.commons.dbcp.BasicDataSource.getConnect ion(BasicDataSource.java:518)
    at org.springframework.jdbc.datasource.DataSourceUtil s.doGetConnection(DataSourceUtils.java:146)
    at org.springframework.jdbc.datasource.DataSourceUtil s.getConnection(DataSourceUtils.java:100)
    at org.springframework.jdbc.datasource.DataSourceUtil s.getConnection(DataSourceUtils.java:76)
    at org.springframework.jdbc.support.JdbcUtils.extract DatabaseMetaData(JdbcUtils.java:133)
    at org.springframework.jdbc.support.JdbcUtils.extract DatabaseMetaData(JdbcUtils.java:173)
    at org.springframework.jdbc.support.SQLErrorCodesFact ory.getErrorCodes(SQLErrorCodesFactory.java:185)
    at org.springframework.jdbc.support.SQLErrorCodeSQLEx ceptionTranslator.setDataSource(SQLErrorCodeSQLExc eptionTranslator.java:113)
    at org.springframework.jdbc.support.SQLErrorCodeSQLEx ceptionTranslator.<init>(SQLErrorCodeSQLExceptionT ranslator.java:92)
    at org.springframework.jdbc.support.JdbcAccessor.getE xceptionTranslator(JdbcAccessor.java:81)
    at org.springframework.jdbc.support.JdbcAccessor.afte rPropertiesSet(JdbcAccessor.java:117)
    at org.springframework.jdbc.core.JdbcTemplate.afterPr opertiesSet(JdbcTemplate.java:194)
    ....


    I do have the jar class in my lib, and my classpath and permisions seem the same as other jars in the same lib. I also use DB visualizer with this same jar file hence connecting to the db with no problem.

    So any ideas ?
    Thank you

  2. #2
    Join Date
    Aug 2004
    Location
    Southampton, UK
    Posts
    826

    Default

    Can you do a new oracle.jdbc.driver.OracleDriver() in the same application? It might be that a class that OracleDriver depends on is not loadable.

    Rob
    Rob Harrop
    Lead Engineer, dm Server
    SpringSource
    http://www.springsource.com

    Co-Author - Pro Spring

  3. #3

    Default Was able to call OracleDriver

    I was able to do the following ,

    OracleDriver od = new OracleDriver();

    and compiled and when the method in which this variable was defined was called it didn't throw any exceptions.

    the import statement

    import oracle.jdbc.*;

    But the same error with the first posting still persists

  4. #4

    Default

    Figured out what the problem was , the jar should be in the tomcat common/lib not in the app's lib. After doing that it doesn't throw the above error . So it seems to be working for now. The connection part at least not my code :?

    Thank you

  5. #5

    Cool

    Quote Originally Posted by kkrikor View Post
    Figured out what the problem was , the jar should be in the tomcat common/lib not in the app's lib. After doing that it doesn't throw the above error . So it seems to be working for now. The connection part at least not my code :?

    Thank you

    Thanks Man! your post helped a lot, was facing the same issue.. resolved via placing the respective jar under tomcat/lib directory..

Similar Threads

  1. Replies: 7
    Last Post: Aug 18th, 2005, 02:41 PM
  2. stale Oracle processes
    By compostellas in forum Data
    Replies: 7
    Last Post: Jun 27th, 2005, 12:14 PM
  3. could not satisfy dependencies
    By springuser in forum Container
    Replies: 4
    Last Post: Apr 26th, 2005, 01:15 PM
  4. Replies: 1
    Last Post: Apr 25th, 2005, 07:37 PM
  5. Oracle Jdbc invalid url problem
    By jfuchs in forum Data
    Replies: 5
    Last Post: Nov 1st, 2004, 11:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •