转自: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. js中的call和apply

    著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处.作者:赵望野链接:https://www.zhihu.com/question/20289071/answer/14745394来源 ...

  2. Nagios配置文件详解

    首先要看看目前Nagios的主配置路径下有哪些文件.[root@nagios etc]# ll总用量 152-rwxrwxr-x. 1 nagios nagios 1825 9月  24 14:40 ...

  3. Gollum 安装笔记

    环境Ubuntu server 14.04 sudo apt-get install ruby1.9.1 ruby1.9.1-dev make zlib1g-dev libicu-dev build- ...

  4. Ubuntu彻底删除MySQL然后重装MySQL

    删除 mysql sudo apt-get autoremove --purge mysql-server-5.0 sudo apt-get remove mysql-server sudo apt- ...

  5. ArrayList实现删除重复元素(元素不是对象类型的情况)

    package 集合; import java.util.ArrayList;import java.util.Iterator; /* * 去除ArrayList里面的重复元素 *  * */pub ...

  6. easyUI 表格

    1.创建 <table id ="ID"></table> 2.属性 dategrid: columns 列的定义的数组 URl:访问远程数据的数组 [“t ...

  7. webform 简单控件

    html中12个表单元素添加runat="server"后称为控件 Lable 编译之后是 <span></span> 属性:CssClass  编译成 c ...

  8. HTML语法大全

      卷标 , 属性名称 , 简介  002 <! - - ... - -> 批注  003 <!> 跑马灯  004 <marquee>...</marque ...

  9. Mac&iOS之多线程--转自http://geeklu.com/2012/02/thread/

    http://geeklu.com/2012/02/thread/ 首先循环体的开始需要检测是否有需要处理的事件,如果有则去处理,如果没有则进入睡眠以节省CPU时间. 所以重点便是这个需要处理的事件, ...

  10. JS脚本收藏(一些实用的函数)

    一.共享onload事件 这个函数的名字是addLoadEvent,它是由Simon Willison 编写的.它只有一个参数:打算在页面加载完毕时执行的函数的名字. 下面是addLoadEvent函 ...