ClassNotFoundException: org. hibernate. hql. ast. HqlToken

Source: Internet
Author: User

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.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.