weblogic:ClassNotFoundException: org.hibernate.hql.ast.HqlToken

There is an application running on weblogic8, and I want to port it to weblogic10. After deployment, the running program has an error: org.springframework.orm.hibernate3.HibernateQueryException: ClassNotFoundException: org.hibernate.hql.ast.HqlToken

found online A lot of information, I found that many solutions are not my dish, and finally the problem is finally solved. The

problem is that the jar package conflict hibernate3 needs the support of antlr-2.7.6.jar, and my installation directory in weblogic10.3

"D:\bea\ There are two jars under "modules" that conflict with the jar (antlr-2.7.6.jar) package in the project. Delete the jar package in weblogic10.3

(com.bea.core.antlr_2.7.7.jar, com.bea.core. antlr.runtime_2.7.7.jar) is fine.

Because everyone has different problems and different versions, the solutions are also different, so other solutions on the Internet are also sorted out for your reference.

Solution 1: If you are using hibernate without spring then you need to set it in hibernate.properties otherwise set the hibernate query translator property in spring <prop key="hibernate.query.factory_class"> org.hibernate.hql. ast.ASTQueryTranslatorFactory </prop> <prop key="hibernate.query.factory_class"> org.hibernate.hql.classic.ClassicQueryTranslatorFactory </prop> Hibernate 3.0 uses a new ANTLR-based HQL/SQL query translator, however, The query translator for Hibernate 2.1 also still exists. In the Hibernate configuration file, the hibernate.query.factory_class property is used to select the query translator. For example: 
    (1) Select the query translator of Hibernate3.0: 
   hibernate.query.factory_class= org.hibernate.hql.ast.ASTQueryTranslatorFactory 
    (2) Select the query translator of 
   Hibernate2.1 hibernate.query.factory_class= org.hibernate. hql.classic.ClassicQueryTranslatorFactory 
    Tip: ANTLR is a compilation tool written in pure Java language. It can generate lexical and syntax analyzers in Java language or C++, and can generate parse trees and traverse the tree. Since ANTLR is pure Java, it can be installed on any platform, but requires JDK support. 
   The Hibernate development team tries its best to ensure that the query translator of Hibernate3.0 can support all query statements of Hibernate2.1. However, for many existing applications, in the upgrade process, you might as well still use the query translator of Hibernate 2.1. 
    It is worth noting that there is a bug in the query translator of Hibernate3.0: it does not support some theta-style connection query dialects: such as Oracle8i's OracleDialect dialect, Sybase11Dialect. There are two ways to solve this problem: (1) Use a dialect that supports ANSI-style connection query, such as Oracle9Dialect, (2) If you encounter this problem when upgrading, then use Hibernate2.1 instead. Query translator.

Solution 2: Set the weblogic.xml file weblogic8.0 under "D:\bea\wlserver_10.3\server\lib\consoleapp\webapp\WEB-INF" to solve this problem is to change weblogic.xml to change a property true <container-descriptor> ... <prefer-web-inf-classes>true</prefer-web-inf-classes> ... </container-descriptor>

Solution 3: Set my directory "D:\bea\wlserver_10.3\server\lib" into antlr-2.7.6.jar and set my directory "D:\bea\user_projects\domains in front of weblogic.jar" \base_domain\bin",

open the setDomainEnv.cmd or startWebLogic.cmd file, find the set CLASSPATH, add

set PRE_CLASSPATH=% DOMAIN_HOME%\lib\antlr-2.7.6.jar;

and add set CLASSPATH=%PRE_CLASSPATH%;%SAVE_CLASSPATH% ATH%

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326220157&siteId=291194637