Query in JPA-Console throws a java.lang.ClassNotFoundException

Hello,

I have a simple Spring-JPA project. In this project the datasource is configured in Spring and is configured as datasource in IntelliJ. This works fine.
My persistence.xml is simple. Only the name of the persistence unit is contained in this file. All other stuff is managed by annotations and Spring.

Now I want to test some of my queries in the JPA Console, eg. select c from Constellation c. After execution of this query the console throws this error:

java.lang.ClassNotFoundException: org.agilebackoffice.wafe.domain.Constellation
 at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Class.java:247)
 at org.hibernate.util.ReflectHelper.classForName(ReflectHelper.java:170)
 at org.hibernate.ejb.Ejb3Configuration.classForName(Ejb3Configuration.java:1302)
 at org.hibernate.ejb.Ejb3Configuration.addNamedAnnotatedClasses(Ejb3Configuration.java:1374)
 at org.hibernate.ejb.Ejb3Configuration.addClassesToSessionFactory(Ejb3Configuration.java:1159)
 at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:1004)
 at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:282)
 at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:366)
 at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:56)
 at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:63)
 at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:47)



Why this happens? Is my project setup not complete or is this a problem because all domain objects are managed by annotations and the persistence xml is empty?
Thanks
Thorsten

Please sign in to leave a comment.