ClassNotFoundException: org.hibernate.hql.ast.HqlToken in Weblogic
Hibernate’s migration guide mentions that WebLogic uses a different version of ANTLR causing this exception.
A work around for this problem (differnet from what Hibernate mentions) is to set the “prefer-web-inf-classes” element in weblogic.xml to true.
<weblogic-web-app> .... <container-descriptor> <prefer-web-inf-classes>true</prefer-web-inf-classes> </container-descriptor> .... </weblogic-web-app>
I encountered this problem several months ago while running under WebLogic 8.x. Interestingly, it still exists in WebLogic 10.x server.
Update for Ear files: When deploying the application as an ear file on WebLogic 10.x server, add the following to weblogic-application.xml file:
<prefer-application-packages> <package-name>antlr.*</package-name> </prefer-application-packages>
The weblogic-application.xml file should be under META-INF folder of the ear file.
Categories: Solutions Log
Man this saved my bacon!!!! A lot better solution than the crap Hibernate and others offered!!!!
Thanks!!!
A simple solution for a problem that’s been plaguing me the whole day. Thank you!
I have a catch-22 situation…
I do pref-web-inf-classes=false to make my spring applicationContext work fine(otherwise linkageError with org.w3x.dom.Document
But then i get this hibernate exception when I start app and try to login(which uses a db query)
If do pref-web-inf-classes=true, like I said before spring app context won’t load up.
If someone needs more detail on this and / or on other ‘beginner’ issues migrating / deploying Web Apps on WebLogic you can start here on my blog titled Migrating to WebLogic – Configure Listener Registration at http://disaak.blogspot.com/2009/11/migrating-to-weblogic-configure.html.
Really…….. Man this saved my bacon!!!! A lot better solution than the crap Hibernate and others offered!!!!
Thanks a million!!!
I am using Weblogic 10.3.2 and had to add a namespace. This is what I put into weblogic-application.xml in the EAR:
antlr.*
What if I’ve a Webservice project instead of a EAR project? There is not a weblogic-application.xml. Wich one can I change to make WL works?
@Jesfre
How are you packaging your webservice? If it is being packaged as a war file, I think you can still include weblogic.xml with prefer-web-inf-classes tag.
@Neal
Hi,
did you ever succeed to get this work with a WAR-file. There you cannot use the weblogic-application.xml
Thanks a lot!!! I forgot to google that problem! With your help i could have this resolved a few days ago!
I have the same problem Neal said.
If I put ‘prefer-web-inf-classes’ to TRUE, then the application doesn’t start:
Error 404–Not Found
From RFC 2068 Hypertext Transfer Protocol — HTTP/1.1:
If I put it to FALSE, I get this exception when I try to login (with db query).
Any help? Thx