I have a .war file for an application that normally runs fine in Jetty.
I’m trying to port the application to run in WebLogic, but at startup I’m getting these exceptions:
ERROR:Foo - Error in named query: findBar
org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken [from Bar]
at org.hibernate.hql.ast.HqlLexer.panic(HqlLexer.java:80)
at antlr.CharScanner.setTokenObjectClass(CharScanner.java:340)
at org.hibernate.hql.ast.HqlLexer.setTokenObjectClass(HqlLexer.java:54)
at antlr.CharScanner.<init>(CharScanner.java:51)
at antlr.CharScanner.<init>(CharScanner.java:60)
at org.hibernate.hql.antlr.HqlBaseLexer.<init>(HqlBaseLexer.java:56)
at org.hibernate.hql.antlr.HqlBaseLexer.<init>(HqlBaseLexer.java:53)
at org.hibernate.hql.antlr.HqlBaseLexer.<init>(HqlBaseLexer.java:50)
...
What’s the best way to fix this?
I’m using Hibernate 3.3.1.GA and WebLogic 10.3.2.0.
WebLogic has its own version of ANTLR and this causes the problem you’re facing. One way to solve it with a web application is to set the
prefer-web-inf-classeselement inweblogic.xmltotrue.The
weblogic.xmlgoes inWEB-INF.