转自:http://www.programgo.com/article/68682994452/

在做查询的时候,报出  org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken这  个错误(是通过数据源连接的)

解决方法如下: 

如果你是通过eclipse启动weblogic的,那么依次点击windows-preferences-myeclipse workbench-servers-weblogic-weblogic10.x-path,在prepend to classpath选项中,把hibernate要用到的包antlr.jar添加到weblogic的classpath中。 
这样在weblogic便可以通过myeclipse正常启动,以上提到的问题解决。 
(该方法亲自试了,可以)

如果你是通过weblogic自带的脚本运行,即通过startWebLogic.cmd启动: 
将工程里的antlr.jar拷贝到weblogic的wlserver_10.3\server\lib文件夹下面,在domains\base_domain\bin里找到startWebLogic.cmd文件,在set classpath 的上下分别增加了两句话,如下: 
    set PRE_CLASSPATH=%WL_HOME%\server\lib\antlr-2.7.6rc1.jar 

    set CLASSPATH=%SAVE_CLASSPATH% 

    set CLASSPATH=%PRE_CLASSPATH%;%CLASSPATH%

还是有些问题的,如果是 ClassicQueryTranslatorFactory 是针对 hibernate 2.1 的,不能处理 delete、update 等, 如果是 3 的话, 就得用另外一个了。 而且还需要 把 antlr-runtime 加在 startWeblogic 启动时设置的 classpath 中,要不会报其它的错误. 

官方的解决办法是在web-inf下创建一个weblogic.xml,配置 
<weblogic-web-app> 
<container-descriptor> 
<prefer-web-inf-classes>true</prefer-web-inf-classes> 
</container-descriptor> 
</weblogic-web-app> 

让weblogic在冲突情况下,默认采用web应用下的lib,而不采用它本身classpath下的jar包即可.

weblogic10异常:org.hibernate.hql.ast.HqlToken的更多相关文章

  1. weblogic 下异常 org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken

    项目之前在 Tomcat 环境下一直都正常运行,今天应客户要求需要迁移到 webLogic 10.3.6 下, 部署后竟然抛出了 org.hibernate.QueryException: Class ...

  2. WebLogic发布S2SH应用时提示ClassNotFoundException: org.hibernate.hql.ast.HqlToken异常

    使用Spring+hibernate如下 <properties> <!--定义方言.fetch深度.是否显示sql--> <property name="hi ...

  3. 解决Eclipse编译器报错ClassNotFoundException:Org.hibernate.hql.ast.HqlToken

    最近开发遇到Eclipse编译器老是报出ClassNotFoundException:Org.hibernate.hql.ast.HqlToken [from User Where id=1] 的错误 ...

  4. hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken

    环境:weblogic10.3.5,hibernate3,GGTS(groovy/grails tools suite):出现这问题是因为该项目是从weblogic8.1.6下移植到weblogic1 ...

  5. weblogic中部署项目报错org.hibernate.QueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken .

    原因: 原因是weblogic要查找自己的antlr,和lib下面的antlr包冲突.... 解决方法: 在weblogic.xml添加 <container-descriptor>    ...

  6. java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.tree.MethodNode(尼玛,蛋疼的错误)

    java.lang.IllegalStateException: No data type for node: org.hibernate.hql.ast.tree.MethodNode   \-[M ...

  7. SSH执行hql报错:Caused by: org.hibernate.hql.ast.QuerySyntaxException: user is not mapped [from user where username = ?]

    报错信息: ERROR Dispatcher:38 - Exception occurred during processing request: user is not mapped [from u ...

  8. org.hibernate.hql.ast.QuerySyntaxException: Student is not mapped [from Student as stu where stu.sclass=?]

    java.lang.IllegalArgumentException: org.hibernate.hql.ast.QuerySyntaxException: t_aty_disease is not ...

  9. org.hibernate.hql.ast.QuerySyntaxException: tb_voteoption is not mapped [from tb_voteoption where voteID=?]

    转自:https://www.cnblogs.com/albert1017/archive/2012/08/25/2656873.html org.hibernate.hql.ast.QuerySyn ...

随机推荐

  1. VBA找不到progress bar的处理办法。

    Search your pc for MSCOMCTL.Ocx. If you find it then register it by clicking on Windows Start Button ...

  2. js 封装设计cookie

    http://www.imooc.com/article/12700<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional/ ...

  3. SSH三大框架的JAR包下载地址

    官网的英文网站读起来有点费劲,把下载地址直接放到这儿,以后免得到处找了 Struts 2 : http://struts.apache.org/download.cgi#struts216 sprin ...

  4. tornado学习笔记14 HTTP1ServerConnection分析

            代表HTTP/1.x 类型的服务器连接,负责处理HTTP/1.x类型的请求. 14.1 构造函数 def __init__(self, stream, params=None, con ...

  5. 细读cow.osg

    细读cow.osg 转自:http://www.cnblogs.com/mumuliang/archive/2010/06/03/1873543.html 对,就是那只著名的奶牛. //Group节点 ...

  6. discuz sphinx全文检索搜索引擎方案

    基于discuz的索引配置文件,这个配置文件比较灵活,可以根据不同的需求来配置 # # linuxTone full index search configure file # source lt_p ...

  7. TranslateAnimation参数

    看TranslateAnimation动画参数,一直忘记四个参数意思: public    TranslateAnimation(float fromXDelta, float toXDelta, f ...

  8. 2016huasacm暑假集训训练四 _排列

    题目链接:http://acm.hust.edu.cn/vjudge/contest/125308#problem/D 这题要求错误的方式有多少种,就是一个错排公式,记得公式就行            ...

  9. awk匹配

    输出匹配funcno或type:awk 'funcno|type' 输出两次正则表达式匹配之间的行:awk '/funcno/, /type/' 删除所有的空行:awk NF 从第8行输出到第12行: ...

  10. 1.Powershell认识

    Windows PowerShell 是一种命令行外壳程序和脚本环境,自Windows Server 2008开始就有内置于系统当中,有取代CMD之势.管理员使用Powershell完成一些日常重复的 ...