After the project is moved from TOMCAT7 to WEBLOGIC12C, the exception org. hibernate. QueryException: ClassNotFoundException occurs:
Org. hibernate. hql. ast. HqlToken;
I checked on the Internet, because hibernate3.0 is based on anlr HQL/SQL query translator, using antlr-x-x-x.jar, however weblogic. jar already contains the antrl class library, and weblogic. the jar loading sequence is limited than the jar loading sequence in the project, leading to the failure of loading the above errors. This problem is caused by the order of class loading. The solution is as follows ):
1. Select the query translator of Hibernate3.0:
Hibernate. query. factory_class = org. hibernate. hql. ast. ASTQueryTranslatorFactory;
Select the query translator for Hibernate2.1
Hibernate. query. factory_class = org. hibernate. hql. classic. ClassicQueryTranslatorFactory;
To use 3.0 of the batch update and delete functions, you can only select 1. When using the Chinese "filter condition", you can only select 2.
In this way, metrics are not permanent, and there may be other loading problems.
2. Copy the antlr-x-x-x.jar to the java path and java extension path JAVA_HOME %/jre/lib/ext /);
3. Change the jar loading priority and use the jar Report of the project first. Add the following settings in weblogic. xml of the deployment project:
<Container-descriptor>
<Prefer-web-inf-classes> true </prefer-web-inf-classes>
</Container-descriptor>.
4. Modify % mydomain % \ startWebLogic. cmd and set CLASSPATH to make the antlr-x-x-x.jar appear before;
Appendix weblogic container loading sequence:
The classloader of the weblogic web Container inherits from the classloader Of The ejb container, and the ejb container inherits from the application classloade to load classes under the classpath ), therefore, the classes under classpath are loaded preferentially by default. Weblogic has the following levels by default:
1. the java path and the java extension path are the most advanced;
2. System Path;
3. classes under/lib and two or more domains are invisible;
4, WEB-INF/lib or WEB-INF/classes, this is the lowest level.