File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes BEA/Weblogic and the fly likes org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken" Watch "org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken" New topic
Author

org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken

Prasanth S Pillai
Ranch Hand

Joined: Oct 28, 2009
Posts: 39
Hi,

I am getting the following error while deploying the ear file in WLS 10.3.2 . This works fine in 9.2. I have done the following as work around.

a) Added the following in weblogic-application.xml.

<?xml version="1.0" encoding="ISO-8859-1"?>
<weblogic-application>
<prefer-application-packages>
<package-name>antlr.*</package-name>
</prefer-application-packages>
</weblogic-application>

It did not work for me.

b) added the antlr.jar in the PRE_CLASSPATH in startWebLogic.cmd.

This also did not work.

I am not sure whether I need to do any other step associated to the above solution. Please suggest.

Regards,
Prasanth
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

The package constrain you configured is for antlr. Not hibernate


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Robertus Haryanto
Greenhorn

Joined: Jun 05, 2008
Posts: 1
I think you should set PRE_CLASSPATH in $DOMAIN_HOME/bin/setDomainEnv.sh
Since on this file, PRE_CLASSPATH are set to blank!
Prasanth S Pillai
Ranch Hand

Joined: Oct 28, 2009
Posts: 39
Thanks everyone. Weblogic had its own antlr jar file reference. Solution Add the respective changes in the weblogic.xml & weblogic-application.xml.
Murali Sridhar
Ranch Hand

Joined: Feb 16, 2009
Posts: 44

Hi Prashant,

I'd be thankful, if you share the changes you made to weblogic.xml and/or weblogic-application.xml file.
I couldn't able to fix it.
Here is my environment details:
App server: Weblogic 10.3.3
Java: JDK1.6
JPA: hibernate-3.1.jar

Regards,
Murali
Prasanth S Pillai
Ranch Hand

Joined: Oct 28, 2009
Posts: 39
Hello Murali,

My workaround is published in http://sprasanth.blogspot.com/

Hope it helps
Murali Sridhar
Ranch Hand

Joined: Feb 16, 2009
Posts: 44

Thanks for the reply. But, no luck for me. Did you check the environment I sent to you.
I have both the files weblogic-application.xml in META-INF and weblogic.xml in WEb-INF.
Updates of these files is overriding my local configurations. Lookeing for the fix, where it has no dependencies in my app.

Even I tried with the PRE_CLASSPATH update in setDomainEnv.cmd for antlr-2.7.5.jar file.
Working on this to fix. Let you know the updates, if any.
Prasanth S Pillai
Ranch Hand

Joined: Oct 28, 2009
Posts: 39
The weblogic.xml changes are required only if you have a EAR file. From the explanation you have given, I presume that you have a windows environment. So you might need only the PRE_CLASSPATH changes in .cmd file.

But first you can verify the following

1. Check if there are more than one occurance of antlr_x_x.jar file in your environment.
2. If there are more occurring, which is obvious as you are getting the exception, then decide from where you want to load it & make changes accordingly.

I am sure this exception occurs due to wrong class loading.

Prasanth
Murali Sridhar
Ranch Hand

Joined: Feb 16, 2009
Posts: 44

Hi Prasanth,

Your check list helped me with some work around.
For 1. There's no more antlr jar file exists, except the WL10.3 provided.
2. I have loaded the file from 'startWebLogic.cmd' (updates for: set CLASSPATH=%WL_HOME%\common\lib\antlr-2.7.6.jar;%SAVE_CLASSPATH%)
and observed that its also working fine from 'setDomainEnv.cmd' (updates for: PRE_CLASSPATH="%{DOMAIN_HOME}%/../lib/pre_classpath_jar/antlr-2.7.6.jar

Make sure to load the file only once( not sure about the behavior, if we load it more than one).
**Only the antlr version:2.7.6 worked for me.
Prasanth S Pillai
Ranch Hand

Joined: Oct 28, 2009
Posts: 39
Glad to know that Murali.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken
 
Similar Threads
Unable to load jar on Weblogic11g server startup.
Web Service *Client*
Log4j in Weblogic - ClassNotFoundException please help
Filtering ClassLoader causing ClassNotFoundException: org.hibernate.event.EventListeners$2
NoClassDefFoundError when deploying application on weblogic 10.3.4