| Author |
hibernate exception
|
Barak So
Greenhorn
Joined: Aug 20, 2012
Posts: 4
|
|
hey,
I'm running a simple hibernate application and getting the following exception:
Exception in thread "main" java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration
at org.soninob.hibernate.HibernateMain3.main(HibernateMain3.java:19)
Caused by: java.lang.ClassNotFoundException: org.hibernate.cfg.Configuration
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more
apparently the hibernate.cfg.xml is not fond.
I created a user folder for all the hibernate jars in my eclipse using hibernate version 3.6.4 and put the the xml file under the src folder.
this is a regular project (not web).
please let me know if additional info is required.
10x!
|
 |
RatiKanta pal
Ranch Hand
Joined: Nov 13, 2011
Posts: 51
|
|
hi,
I think the hibernate libraries are not available to Tomcat.You can try one thing
Right click your project -> Build Path -> Configure Build Path--> remove the hibernate set from the build path,Now import the jars into the WEB-INF/lib folder. Refresh your project.And run it.
|
 |
Barak So
Greenhorn
Joined: Aug 20, 2012
Posts: 4
|
|
10x for replying,
regarding tomcat, I already worked with it on other machine and I run the same example - the only different is that I used ojdbc4.jar and now I'm using the ojdbc6.jar.
like I said before I'm using a regular project, not a web project and I don't have the WEB-INF folder.
I'm working accordingly to koushks tutorial: http://www.youtube.com/watch?v=bzPkebUXxn0&feature=relmfu
|
 |
RatiKanta pal
Ranch Hand
Joined: Nov 13, 2011
Posts: 51
|
|
|
Oh.Is it working with ojdbc4.jar the same machine you are working now?
|
 |
Barak So
Greenhorn
Joined: Aug 20, 2012
Posts: 4
|
|
actually it was working on other machine with tomcat and ojdbc4.jar.
on my private machine I didn't find from where to download ojdbc4.jar so I'm working with ojdbc6.jar
|
 |
Barak So
Greenhorn
Joined: Aug 20, 2012
Posts: 4
|
|
one other thing, my classpath looks like that:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Hibernate3"/>
<classpathentry kind="lib" path="C:/Program Files/Java/jdbc/ojdbc6.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
is the hibernate.cfg.xml file should be define also in the classpath? (it is locate in the default location under the src folder. the Hibernate3 folder is containing 9 jars relevant for hibernate.
|
 |
 |
|
|
subject: hibernate exception
|
|
|