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

ClassNotFoundException: org.hibernate.hql.ast.HqlToken in Weblogic

September 5th, 2007

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.

Balaji Solutions Log

  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!!!!

    Thanks!!!

  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.

  1. No trackbacks yet.