• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HibernateException: JDBC Driver class not found: oracle.jdbc.driver.OracleDriver

 
Ranch Hand
Posts: 71
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Trying to create a standalone application using Hibernate 3.0 and Oracle 10g. The Client Application, POJO class, Mapping File and Configuration File are placed in the same folder, and all the required jar files including ojdbc14.jar are included in the classpath. Compilation is Fine, but during execution throwing HibernateException: JDBC Driver class not found: oracle.jdbc.driver.OracleDriver.

The driver_class, url, username, password are mapped in configuration file and using the same in normal jdbc application able to insert data in the table. But in this case it is throwing exception.

Please suggest.
 
Ranch Hand
Posts: 1514
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Verify your classpath settings for the location of that driver. That driver cannot be resolved, which points to a classpath issue.
 
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your missing the oracle jdbc jar.

http://findjar.com is a handy resource.
 
Deepak Kumar Jena
Ranch Hand
Posts: 71
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The ojdbc14.jar has been copied from the Oracle installation folder and placed in a folder named Libraries. The jar has been added to the classpath. I am able to write/run normal jdbc applications and even the same in Struts application. But in case of Hibernate it is generating exception.
 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please provide your DB configuration file.

Regards,
Naresh
 
Philip Thamaravelil
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How are you compiling and executing? Ant?

Your hibernate jar's are in the same directory as the oracle jdbc jar correct?

 
Deepak Kumar Jena
Ranch Hand
Posts: 71
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am compiling the files using javac in command prompt. The hibernate.jar and ojdbc14.jar are placed under the same folder i.e. C:\Libraries and both has been added to the classpath.
 
Deepak Kumar Jena
Ranch Hand
Posts: 71
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Marshal
Posts: 28177
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Deepak Kumar Jena wrote:I am compiling the files using javac in command prompt. The hibernate.jar and ojdbc14.jar are placed under the same folder i.e. C:\Libraries and both has been added to the classpath.



That has nothing at all to do with errors which happen at run time.
 
Philip Thamaravelil
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are you compiling a executable jar file?

If so, have you included the oracle jar path in the executable jar's Manifest?


Ant usually eliminates (or minimizes) these types of issues.


 
Deepak Kumar Jena
Ranch Hand
Posts: 71
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Deepak Kumar Jena
Ranch Hand
Posts: 71
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Deepak Kumar Jena
Ranch Hand
Posts: 71
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Deepak Kumar Jena
Ranch Hand
Posts: 71
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am getting error during compilation (Not using Ant). The jar files are placed in the classpath and they are visible in command prompt (using classpath). Database is also up. I have doubts about the version of the JARS. Suggest about all the required JARS with version detail.
 
Philip Thamaravelil
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sounds like to are compiling EmployeeBean with the c:\libraries classpath set in javac,
then run the EmployeeBean class directly with the java command right?


Here's what I would do if I had this problem:

I would change the directory structure:

myproject\
myproject\lib <-- put all jars in this directory.
myproject\src <-- your EmployeeBean and other java files here.
myproject\build
myproject\build.xml

Then using ant, I would compile the code in src to create a jar file that has a class-path specified relative to the current location..


Here's a sample:



Then from your command line...run the ant tasks defined for compiling and building..

afterwords..once you compile your runnable jar...you can simply run it by...

#>java -jar myRunnableJar.jar

 
Philip Thamaravelil
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is your command syntax for compiling and executing?

 
Deepak Kumar Jena
Ranch Hand
Posts: 71
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using javac *.java at the command prompt. The POJO class (EmployeeBean.java) is getting compiled into .class file while the Hibernate Client Application (EmployeeClient.java) is throwing Exception during compile-time.

Actually, I am interested in compiling the files manually through Command prompt, but not interested in using tools like Ant for this purpose.
 
Philip Thamaravelil
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You will consistently run into these types of issues with your build process.

 
Deepak Kumar Jena
Ranch Hand
Posts: 71
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am looking forward to debug the issue to find out the root cause. Using tools to avoid the errors is not a good move. As per my knowledge the issues are related to the dtd schema (XML) and may be specific to the environment (jar versions, classpath settings,etc). Even the same Exception is getting generated in MyEclipse.
 
reply
    Bookmark Topic Watch Topic
  • New Topic