0

I am getting the same error as in exception is java.lang.IllegalStateException: Could not load JDBC driver class. I have added ojdbc14.jar inside src/main/resources/lib. Still getting:-

    PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.driver.OracleDriver]
    Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ds' defined in class path resource [dbOperations.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
    PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [oracle.jdbc.driver.OracleDriver]

I am loading the jdbc driver :-

    context = new ClassPathXmlApplicationContext("dbOperations.xml");
2
  • please show how you load the driver Commented Apr 3, 2018 at 12:52
  • It is not immediately related to your problem, but are you aware that ojdbc14.jar is for Java 1.4, and therefore more than 14 years out of date? You might want to consider not using ancient libraries. Commented Apr 4, 2018 at 7:16

1 Answer 1

4

Placing the jar into the src/resources/lib isn't going to put the class files on your classpath.

Depending on if you're using something like Maven or Gradle, you'll need to add the ojdbc jar as a dependency in your pom or gradle file.

If you're not using this, you'll have to make sure the ojdbc jar file is listed in your -classpath arguments when you start up the JVM.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.