在配置中加以下属性就可以解决
<prop key="hibernate.query.factory_class">org.hibernate.hql.ast.ASTQueryTranslatorFactory</prop>
使用Spring+hibernate如下
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.generate_statistics">true</prop>
<!-- 解决weblogic抛出的ClassNotFoundException: org.hibernate.hql.ast.HqlToken异常-->
<prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</prop>
</props>
</property>
上面这样还是使用Hibernate2的查询机制,根据回复经验证后可以按下面设置使用hibernate3的查询机制:
1、拷贝Hibernate3里带的包antlr-2.7.5H3.jar到%WL_HOME%\server\lib下
2、修改startWebLogic.cmd :
在set CLASSPATH之前加上下面一句:
set PRE_CLASSPATH=%WL_HOME%\server\lib\antlr-2.7.5H3.jar;
在set CLASSPATH之后加上下面一句:
set CLASSPATH=%PRE_CLASSPATH%;%CLASSPATH%
一切OK!
具体原因可参照此页:http://dev2dev.bea.com/blog/pmalani/archive/2005/07/configuring_web.html