转自: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. Java知识点归总一之堆栈

    Java栈与堆 (一天一个知识点2014-07-28) ----对这两个概念的不明好久,终于找到一篇好文,拿来共享 1. 栈(stack)与堆(heap)都是Java用来在Ram中存放数据的地方.与C ...

  2. CodeForces 514B

    B. Han Solo and Lazer Gun time limit per test 1 second memory limit per test 256 megabytes input sta ...

  3. 【NOIP考前模拟赛】纯数学方法推导——旅行者问题

    一.写在前面 这题似乎是一道原创题目(不是博主原创),所以并不能在任何OJ上评测,博主在网盘上上传了数据(网盘地址:http://pan.baidu.com/s/1mibdMXi),诸位看官需者自取. ...

  4. WebCrawler

    WebCrawler WebCrawler is a metasearch engine that blends the top search results from Google Search a ...

  5. Lua系统库

    Lua为了保证高度的可移植性,因此,它的标准库仅仅提供了非常少的功能,特别是和OS相关的库.但是Lua还提供了一些扩展库,比如Posix库等.对于文件操作而言,该库仅提供了os.rename函数和os ...

  6. Java WebService 简单实例

    前言:朋友们开始以下教程前,请先看第五大点的注意事项,以避免不必要的重复操作. 一.准备工作(以下为本实例使用工具) 1.MyEclipse10.7.1 2.JDK 1.6.0_22 二.创建服务端 ...

  7. Android课程---添加黑名单的练习2(课堂讲解)

    实现黑名单的添加.修改.查询和删除,首先得有封装的3个类,便于使用 BlackNumber.java package com.hanqi.test3; /** * Created by Adminis ...

  8. mysql5.1升级到mysql5.6

    这么大跨度的升级,本身不推荐.升级应该是循序渐进的,以防止不兼容.如果确实要这么做,你先要确保你的客户端管理工具要能兼容,比如phpmyadmin,此次升级依然存在一个问题,mysql server和 ...

  9. ES6 will change the way you write JS code.

    https://hacks.mozilla.org/2015/04/es6-in-depth-an-introduction/ Counting to 6 The previous editions ...

  10. Spring 000 框架简介 (转载)

    转载自:https://my.oschina.net/myriads/blog/37922 1.使用框架的意义与Spring的主要内容 随着软件结构的日益庞大,软件模块化趋势出现,软件开发也需要多人合 ...