| Author |
java.lang.ClassNotFoundException: No ClassLoaders found for: myClass
|
Dave Alvarado
Ranch Hand
Joined: Jul 02, 2008
Posts: 434
|
|
Hi,
I'm using Hibernate 4.0.1.Final. Hibernate is having trouble finding one of my classes, and it appears correctly spelled. In my hibernate.cfg.xml file (located at the root of my JAR), I have
I load the file like so
but when the above executes, the following exception is thrown …
However, I have verified that the class exists at the root of my JAR at com/myco/fdr/myproject/model/UserRole.class . Any ideas why Hibernate isn't able to track it down?
Thanks, - Dave
|
 |
Paul Clapham
Bartender
Joined: Oct 14, 2005
Posts: 16483
|
|
|
Is the Hibernate jar in the classpath as well? Or did you perhaps decide to put the Hibernate jar into the JRE's extensions directory?
|
 |
Dave Alvarado
Ranch Hand
Joined: Jul 02, 2008
Posts: 434
|
|
|
Hi, The Hibernate classes are also getting included in my Jar. Why are you asking about that, though? The exception is complaining about one of my classes and in the stack trace, one of the Hibernate classes is successfully invoked. - Dave
|
 |
Jo Joseph
Greenhorn
Joined: Nov 28, 2010
Posts: 23
|
|
|
Can you post some more code.
|
 |
Bill Gorder
Bartender
Joined: Mar 07, 2010
Posts: 1282
|
|
Well AnnotationConfiguration is deprecated. You should be using Configuration now.
so
Are you sure you are using javax.persistence.Entity instead of org.hibernate.annotation.Entity? If you are using the hibernate one by accident the AnnotationConfiguration class will ignore it. To test this you can try adding the class pragmatically instead and see what happens.
Also note that if you have a file called hibernate.cfg.xml on the root of classpath you do not need to specify it explicitly, as this is the default.
|
[How To Ask Questions][Read before you PM me]
|
 |
 |
|
|
subject: java.lang.ClassNotFoundException: No ClassLoaders found for: myClass
|
|
|