I have a problem with JPA and JPQL. I have the next query:
String query="SELECT c from Cliente c";
Query quer=em.createQuery("Select c from Cliente c");
List<Cliente> lista= quer.getResultList();
When I execute that, i hace the following error :
[java] Exception in thread "main" java.lang.NoClassDefFoundError: antlr/RecognitionException [java] at org.hibernate.hql.internal.ast.ASTQueryTranslatorFactory.createQueryTranslator(ASTQueryTranslatorFactory.java:59) [java] at org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:103) [java] at org.hibernate.engine.query.spi.HQLQueryPlan.(HQLQueryPlan.java:80) [java] at org.hibernate.engine.query.spi.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:168) [java] at org.hibernate.internal.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:221) [java] at org.hibernate.internal.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:199) [java] at org.hibernate.internal.SessionImpl.createQuery(SessionImpl.java:1735) [java] at org.hibernate.ejb.AbstractEntityManagerImpl.createQuery(AbstractEntityManagerImpl.java:291) [java] at test.TestCliente.main(TestCliente.java:35) [java] Caused by: java.lang.ClassNotFoundException: antlr.RecognitionException [java] at java.net.URLClassLoader$1.run(URLClassLoader.java:366) [java] at java.net.URLClassLoader$1.run(URLClassLoader.java:355) [java] at java.security.AccessController.doPrivileged(Native Method) [java] at java.net.URLClassLoader.findClass(URLClassLoader.java:354) [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:423) [java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) [java] at java.lang.ClassLoader.loadClass(ClassLoader.java:356) [java] ... 9 more
The class CLiente is accesible, but I cant make a query.
Anyone knows why?
EDIT: In the classpath is the class RecognitionException and I can import him, so i dont know what is the problem.