问题描述
我试图移植应用程序以在WebLogic中运行,但在启动时我收到以下例外情况:
错误:Foo - 指定查询中出错: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)
...
解决这个问题的最好方法是什么?我使用Hibernate 3.3.1.GA和WebLogic 10.3.2.0。
WebLogic具有自己的ANTLR版本,这会导致您遇到的问题。使用Web应用程序解决此问题的一种方法是在 weblogic.xml中设置
到 prefer-web-inf-classes
元素 true
。
< weblogic-web-app>
....
< container-descriptor>
< prefer-web-inf-classes> true< / prefer-web-inf-classes>
< / container-descriptor>
....
< / weblogic-web-app>
weblogic.xml
进入 WEB-INF
。
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-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>
The weblogic.xml
goes in WEB-INF
.
这篇关于在WebLogic中运行时的ClassNotFoundException(HqlToken)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!