weblogic10異常:org.hibernate.hql.ast.HqlToken

來源:互聯網
上載者:User

標籤:

轉自: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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.