Hibernate's Antlr generated in Weblogic reason Jar history of the conflict, as well as the solution

Hibernate is used in grammar parser antlr, WebLogic equally.
Many users encounter ClassNotFoundException: org.hibernate.hql.ast.HqlToken of the typical problems, this classic problem has been configured to weblogic.xml, give priority to load the requested Web application WEB-INF of the Jar (ie application Classloader) instead of WebLogic's System Classloader to be barely resolved:
<prefer-web-inf-classes> true </ prefer-web-inf-classes>
</ container-descriptor>
</ weblogic-web-app>

Hibernate 3.0 user found out that the method is still not solve the problem because Hibernate uses Class.forName to Load a class, while the JVM loads the class approach is the first System Classloader (WebLogic), after the Application Classloader (Web applications), result, Applications Even with the prefer-web-inf-classes strategy, but Class.forName or Load the WebLogic's Antlr! !

Hibernate 3.1 solves this problem quickly, Hibernate will use the context classloader, Class.forName this evil code has been eliminated.

Coincidentally, in 2005 Australia's Suncorp-Metway companies use Hibernate3.0.3 + WebLogic8.1SP4 develop their application, then WebLogic 8.1SP4 built-antlr 2.7.1, with Hibernate 3.0.3 bundled antlr-2.7.5H3. jar of conflict, Suncorp-Metway's wish to change the WebLogic's SystemClassPath (adding antlr-2.7.5H3.jar), effect is equivalent to replacing WebLogic's Antlr, of course, Hibernate can solve the problem, but God knows what would be problem because the WebLogic's own Antlr will be used to analyze EJBQL (if not applicable CMP, the user can regardless of 3721, replacement of WebLogic's Antlr version of the), Suncorp-Metway's worried that the replacement of other effects on the system brings the hope that BEA continues to provide technical support.
At that time, as the BEA in Queensland, Australia's largest BEA customers, they would certainly be enough respect. To this end, BEA 8.1 SP4/SP5 have provided a patch, equivalent to upgrade the WebLogic 8.1 comes with Antlr version, WebLogic 8.1SP6 and WebLogic 9.1 start has been following this change.

Obviously, this approach can not be re-used until after the SP, because Antlr as well as an updated version of Hibernate much faster than the speed of WebLogic Service pack update, BEA can not be reconstructed Antlr constantly to adapt to the ever-changing open-source API change.

WebLogic 8.1 SP6 later, when using Hibernate 3 (strategy <prefer-web-inf-classes> true </ prefer-web-inf-classes>) of the Antlr 2.7.6 when it is the turn WebLogic own Servlet container problems ( Hibernate Well, WebLogic something has happened) throws Exception Antlr following:
java.lang.ClassCastException: antlr.CommonToken
at antlr.CharScanner.makeToken (CharScanner.java: 175)
at weblogic.servlet.jsp.JspLexer.mWORD (JspLexer.java: 4723)
at weblogic.servlet.jsp.JspLexer.mXML_ATTRIBUTES (JspLexer.java: 4309)
at weblogic.servlet.jsp.JspLexer.mTAGLIB_DIRECTIVE_BODY (JspLexer.java: 5034)
at weblogic.servlet.jsp.JspLexer.mTAGLIB_DIRECTIVE (JspLexer.java: 4905)
at weblogic.servlet.jsp.JspLexer.mDIRECTIVE (JspLexer.java: 4751)
at weblogic.servlet.jsp.JspLexer.mSTANDARD_THING (JspLexer.java: 2161)
at weblogic.servlet.jsp.JspLexer.mTOKEN (JspLexer.java: 1947)
at weblogic.servlet.jsp.JspLexer.nextToken (JspLexer.java: 1820)
at weblogic.servlet.jsp.JspLexer.nextToken (JspLexer.java: 1820)
at weblogic.servlet.jsp.JspLexer.parse (JspLexer.java: 963)
at weblogic.servlet.jsp.JspParser.doit (JspParser.java: 106)
at weblogic.servlet.jsp.JspParser.parse (JspParser.java: 234)
at weblogic.servlet.jsp.Jsp2Java.outputs (Jsp2Java.java: 125)

The problem is that WebLogic Servlet container do not realize that the version of Hibernate users of ANTLR needs:
1) In the old Antlr 2.7.1 in, WebLogic's Servlet container to use antlr.CharScanner through the following methods Class.forName (String className) Load token, because the jsp compiled classes in itself is based on the WebLogic System Classloader, therefore, Classloader, of course the use of WebLogic's Antlr version (2.7.1), WebLogic is not Hibernate's Antlr (2.7.6) be affected by, Class.forName transition into the System CL by the statute antlr.CommonToken not be a problem.
2) When WebLogic Antlr 2.7.1 + Hibernate Antlr2.7.6 when used together, Servlet containers CharScanner using Class.forName (String, boolean, ClassLoader) to load the token, while the third parameter is the injection of the current application of The Classloader, that WebLogic forced to use the Hibernate's Antlr 2.7.6, which will eventually lead to the container that will Antlr 2.7.6 of the CommonToken transformation into a Antlr 2.7.1 of CommonToken appear java.lang.ClassCastException.

This situation can only do two things:
1) to obtain a copy of this Case patch BEA
2) pre-System ClassPath, so that the new version of Antlr always placed in front of.

About so many things, in fact, wish to reveal the ultimate question is, whether it is Hibernate, and WebLogic, at the beginning when they are not aware of the importance of open-source code refactoring. WebLogic has indeed been the early version of the XML Parser to pay the costs of conflict, so late a lot of XML packets are WebLogic re Rename Package (refactoring code in a way). If you start, WebLogic on the use of com.bea.opensource.antlr to let their own containers to use Antlr, ANTLR conflict, these issues certainly does not appear.

WebLogic 10 really have begun a large-scale reconstruction of Jar package, unfortunately, in this world, there is a hidden rule known as backward compatibility, therefore, <prefer-web-inf-classes> true </ prefer-web-inf-classes> yes J2EE initial stage we still need to accept the reality, of course, you can look forward to another technology to solve this problem - OSGI, in fact, this version may be faster than we thought, or on WebLogic 12g.

分类:Java 时间:2008-06-04 人气:493
blog comments powered by Disqus


  • Linux system, modify the svn account password through the WEB 2010-09-09

    Linux system, modify the svn account password through the WEB Increase the virtual directory vi / etc / httpd / conf / httpd.conf file to add the final Alias / svnadmin "/ var / www / html / svnadmin /" <Directory "/var/www/html/svnadmin

  • Rights management system open source organizations (including the AJAX application framework to achieve EOS) (updated 071016) 2010-03-12

    Rights management system open source organizations (including the AJAX application framework to achieve EOS) (updated 071016) Published :2007-10-16 00:00:00 author: goCom Source: goComDevCenter Language: English Reading Views: 28186 times ===========

  • spring timer support on the web in simple timer operation 2010-09-09

    1 consists of two steps: 1. Write a subclass of java.util.Timer achieve run method. package com.test; /** * @author Evan */ public class TimerTaskSample extends java.util.TimerTask { @Override public void run() { System.out.println("spring is invokin

  • Website technical analysis report - Happy web (kaixin.com) 2010-09-13

    Wedge Has been studying Internet technology, such as frequently visited sites, whim, why we do not look at these sites is how the technical architecture like? Look at the source code? Thus they were in this series, first looking for? I want to look f

  • guzz1.2.7 beta1 released in support of asynchronous Web service call 2010-04-07

    Asynchronous calls in the implementation of services refer to services, while the current thread without blocking the continued implementation of the calculation of when the service is completed, then returned to the current thread is used to achieve

  • HQL query and grammar 2011-05-24

    HQL:Hibernate Query Language HQL Is fully object-oriented query language, it can support features such as inheritance and polymorphism . HQL Query depends on the Query class , Each instance corresponds to a query object Query , HQL query by using The

  • Multi-database support for application design 2010-03-15

    http://hi.baidu.com/stylelive/blog http://hi.baidu.com/stylelive/blog/item/4f2eeeb4f8e594778bd4b206.html View articles and more database applications to support design March 9, 2008 00:03 am Sunday paper without special specify site, are original, no

  • SQL2000 system tables. Stored procedure. The function and application of Function 2010-12-24

    -------------------------------------------- ---- System table ------------------------------------------ While using the system stored procedures, functions and information systems architecture view can already provide us with a wealth of metadata i

  • "Spring security application" of the basic certification conflict with nginx's basic certification 2010-07-02

    Today's visit was originally to nginx plus a certification requirements, using a auth_basic, results not only certification of the time my own authentication pop-up box, you enter in my own authentication information, then pop up a prompt is not "spr

  • Application of Web 2.0 business model 10 2010-11-07

    Subscribe Web2.0 applications 1. Fixed subscription. Refers to the user per month for a certain product or service pay. For example, you can cancel the ad charges. Fixed Subscribe faces two issues: first is the need to charge a subscription system, t

iOS 开发

Android 开发

Python 开发



PHP 开发

Ruby 开发






Javascript 开发

.NET 开发



Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 黔ICP备15002463号-1

processed in 0.246 (s). 12 q(s)