Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Prasanth S Pillai
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The package constrain you configured is for antlr. Not hibernate
 
Robertus Haryanto
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 44
Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Prasanth S Pillai
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Murali,

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

Hope it helps
 
Murali Sridhar
Ranch Hand
Posts: 44
Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 44
Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 39
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad to know that Murali.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic