-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: ClassNotFoundException: org.hibernate.hql.ast.HqlToken
PostPosted: Mon Aug 14, 2006 4:46 pm 
Regular
Regular

Joined: Wed Feb 15, 2006 9:09 pm
Posts: 76
Hibernate version: 3.1.3

Full stack trace of any exception that occurs:

Name and version of the database you are using: Oracle 10gR2

Hello,

I get the following exception when trying to run a query on Oracle AS 10.1.3:

Code:
org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken [from test.User where name = ?]
   at org.hibernate.hql.ast.HqlLexer.panic(HqlLexer.java:57)
   at antlr.CharScanner.setTokenObjectClass(CharScanner.java:340)
   at org.hibernate.hql.ast.HqlLexer.setTokenObjectClass(HqlLexer.java:31)
   at antlr.CharScanner.<init>(CharScanner.java:51)
   at antlr.CharScanner.<init>(CharScanner.java:60)
   at org.hibernate.hql.antlr.HqlBaseLexer.<init>(HqlBaseLexer.java:56)
   at org.hibernate.hql.antlr.HqlBaseLexer.<init>(HqlBaseLexer.java:53)
   at org.hibernate.hql.antlr.HqlBaseLexer.<init>(HqlBaseLexer.java:50)
   at org.hibernate.hql.ast.HqlLexer.<init>(HqlLexer.java:26)
   at org.hibernate.hql.ast.HqlParser.getInstance(HqlParser.java:44)
   at org.hibernate.hql.ast.QueryTranslatorImpl.parse(QueryTranslatorImpl.java:232)
   at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:155)
   at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:109)
   at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:75)
   at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:54)
   at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
   at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
   at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
   at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1583)
   at ca.indosoft.util.Persistence.get(Persistence.java:317)
   at edu.fcps.opsched.system.db.User.get(User.java:42)
   at edu.fcps.opsched.system.action.LoginAction.execute(LoginAction.java:55)
   at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
   at edu.fcps.opsched.common.OpschedRequestProcessor.processActionPerform(OpschedRequestProcessor.java:52)
   at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
   at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
   at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
   at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:64)
   at edu.fcps.opsched.util.OpschedFilter.doFilter(OpschedFilter.java:86)
   at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:15)
   at ca.indosoft.util.Persistence.doFilter(Persistence.java:292)
   at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:627)
   at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:376)
   at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.doProcessRequest(HttpRequestHandler.java:870)
   at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:451)
   at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:299)
   at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].server.http.AJPRequestHandler.run(AJPRequestHandler.java:187)
   at oracle.oc4j.network.ServerSocketReadHandler$SafeRunnable.run(ServerSocketReadHandler.java:260)
   at com.evermind[Oracle Containers for J2EE 10g (10.1.3.0.0) ].util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:303)
   at java.lang.Thread.run(Thread.java:595)


Everything seems to start up just fine, including session factory initialization, config init, etc..

Any ideas where to start? :)


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 14, 2006 4:57 pm 
Expert
Expert

Joined: Tue Apr 25, 2006 12:04 pm
Posts: 260
This post http://forum.hibernate.org/viewtopic.php?t=961698&highlight=hqltoken gives the solution about replacing antlr.jar file


Top
 Profile  
 
 Post subject: Argh... didn't work
PostPosted: Mon Aug 14, 2006 5:21 pm 
Regular
Regular

Joined: Wed Feb 15, 2006 9:09 pm
Posts: 76
I replaced the .jar file (and even set in hibernate.properties to use the old query parser), rebooted, and am still getting the same stacktrace. Here's what I set in hibernate.properties:

Code:
hibernate.query.factory_class=org.hibernate.hql.ast.ASTQueryTranslatorFactory


What I found odd was that both antlr.jar's (one in the oc4j subdir, the other in toplink/jlib) had the exact same file size as the antlr.jar shipped with Hibernate 3.1.3. Any other ideas?

EDIT: I just realized that using "ASTQueryTranslator" is a little defeatist if my purpose was to use the old query parser :). Ahh well... will post another reply WHEN it works.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 15, 2006 2:59 pm 
Regular
Regular

Joined: Wed Feb 15, 2006 9:09 pm
Posts: 76
I still have no idea what's going on here. I've replaced all the antlr.jar's and am still getting this problem. I'm going to see if I can somehow force the application server to use the antlr.jar supplied in the .war. I did this with ejb-persistence.jar (The persistence jar shipped with the app server doesn't understand javax.persistence.Basic.optional()), but it doesn't seem to work with antlr.jar, assuming the problem is with this .jar. Still hunting around for other possibilities.

Thanks.


Top
 Profile  
 
 Post subject: Got it
PostPosted: Tue Aug 15, 2006 4:00 pm 
Regular
Regular

Joined: Wed Feb 15, 2006 9:09 pm
Posts: 76
I downloaded and compiled antlr from the official website. Two possibilities:

1) Hibernate 3.1.3 ships with the wrong antlr.jar (pre-2.7.6)
2) Hibernate 3.1.3 ships with the CORRECT antlr, but I recently updated hibernate.jar without updating dependant libraries.

In any case, this works fine, even though the old antlr.jar is still in the application server's installation path. I checked the [x] Use Local Paths First or something in the deployment descriptor, which seems to force it to use my antlr.jar shipped in the .war.

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 16, 2006 1:45 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
There more likely scenario

3) Your application server have antlr.jar on its classpath and it is not proper isolated.


I had only heard about Weblogic doing this; did Oracle add some antlr dependent library lately ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Aug 16, 2006 10:17 am 
Regular
Regular

Joined: Wed Feb 15, 2006 9:09 pm
Posts: 76
Toplink needs it. I was wrong about the libraries before, there is only one copy of antlr.jar in the installation folder, and it's the old version. I shipped a new antlr.jar in my WAR without touching the installed one and everything works fine.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.