|
Re: ClassNotFoundException on create of TypedQuery [message #646653 is a reply to message #646634] |
Wed, 29 December 2010 16:33 |
Michael OBrien Messages: 34 Registered: July 2009 |
Member |
|
|
Christoph,
Hi, it looks like you are missing the antlr plugin project. You can inport the source or jar at the following location. Note: you could also reference the nightly eclipselink.jar which incorporates the antlr project as well.
See the missing class and it's ANTLR project:
http://dev.eclipse.org/svnroot/rt/org.eclipse.persistence/tr unk/plugins/org.eclipse.persistence.antlr/src/org/eclipse/pe rsistence/internal/libraries/antlr/runtime/Parser.java
The point of the CNFE is during named query parsing. It is pretty hard to reproduce the ClassNotFoundException because there are so many references to antlr via the jpa or core project (I am running the same 64 bit environment as you - but this is a classpath issue).
In the following code JPQLParser extends antlr.runtime.Parser which requres the antlr project and antlr dependency.
EJBQueryImpl.java:211
public static DatabaseQuery buildEJBQLDatabaseQuery(String queryName, String jpql, Session session, Enum lockMode, Map<String, Object> hints, ClassLoader classLoader) {
JPQLParseTree parseTree = JPQLParser.buildParseTree(queryName, jpql);
antlr is a dependency on the core project (itself a dependency of the jpa project).
In the manifest
Require-Bundle: org.eclipse.persistence.antlr;bundle-version="2.2.0.qualifier ";resolution:=optional
Example:
Entity.....
@NamedQuery(
name="findAllHyperCubes",
query="SELECT OBJECT(h) FROM HyperCube h WHERE h.size > 0")
public class HyperCube<P> extends ComputeFabric implements Serializable
SE Client...
TypedQuery<HyperCube> aQuery = anEntityManager.createNamedQuery("findAllHyperCubes", HyperCube.class);
List<HyperCube> resultList = aQuery.getResultList();
runs as....
GridClient [Java Application]
org.eclipse.persistence.example.dataparallel.GridClient at localhost:63557
Thread [main] (Suspended)
EJBQueryImpl<X>.buildEJBQLDatabaseQuery(String, String, Session, Enum, Map<String,Object>, ClassLoader) line: 213
JPAQuery.processJPQLQuery(Session) line: 106
JPAQuery.prepare() line: 90
JPAQuery(DatabaseQuery).checkPrepare(AbstractSession, AbstractRecord, boolean) line: 577
JPAQuery(DatabaseQuery).checkPrepare(AbstractSession, AbstractRecord) line: 537
Giving us a parse tree....
parseTree JPQLParseTree (id=88)
classLoader null
context ParseTreeContext (id=91)
distinctState 0
fromNode FromNode (id=93)
groupByNode null
havingNode null
orderByNode null
queryNode SelectNode (id=97)
setNode null
unusedVariables null
validated false
whereNode WhereNode (id=100)
ServerSession(AbstractSession).processJPAQueries() line: 1985
ServerSession(DatabaseSessionImpl).initializeDescriptors() line: 409
ServerSession(DatabaseSessionImpl).postConnectDatasource() line: 667
ServerSession(DatabaseSessionImpl).login() line: 628
You can do one of 3 things.
1) add the org.eclipse.persistence.antlr project directly
<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.persistence.antlr"/>
2) add a reference to the org.eclipse.persistence.core project (which won't compile without the antlr subproject)
<classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.persistence.core"/>
3) or add eclipselink.jar directly to your classpath
<classpathentry kind="lib" path="F:/view_w35e/eclipselink.jar" sourcepath="/org.eclipse.persistence.jpa"/>
thank you
/michael
http://www.eclipselink.org
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03976 seconds