Home > Solutions Log > ClassNotFoundException: org.hibernate.hql.ast.HqlToken in Weblogic

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.


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:


The weblogic-application.xml file should be under META-INF folder of the ear file.

Categories: Solutions Log Tags:
  1. John McPeek
    August 1st, 2008 at 10:27 | #1

    Man this saved my bacon!!!! A lot better solution than the crap Hibernate and others offered!!!!


  2. Rich Wilcox
    January 21st, 2009 at 16:52 | #2

    A simple solution for a problem that’s been plaguing me the whole day. Thank you!

  3. Neal
    April 27th, 2009 at 20:22 | #3

    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.

  4. Donald Isaak
    November 11th, 2009 at 16:22 | #4

    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.

  5. Ronin
    February 16th, 2010 at 06:27 | #5

    Really…….. Man this saved my bacon!!!! A lot better solution than the crap Hibernate and others offered!!!!
    Thanks a million!!!

  6. Koert
    April 20th, 2010 at 23:48 | #6

    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:


  7. April 23rd, 2010 at 07:24 | #7

    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?

  8. April 23rd, 2010 at 08:21 | #8

    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.

  9. Stefaan Somers
    April 28th, 2010 at 04:51 | #9


    did you ever succeed to get this work with a WAR-file. There you cannot use the weblogic-application.xml

  10. Marcelo
    May 26th, 2010 at 11:29 | #10

    Thanks a lot!!! I forgot to google that problem! With your help i could have this resolved a few days ago!

  11. CSA
    July 9th, 2010 at 03:09 | #11

    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

  1. No trackbacks yet.