Recently, I was very busy. Now I have a little time to test weblogic classloader. The principle of classloader is overwhelming on google and will not be mentioned here.
First, we use two use cases to test the classloader hierarchy of the basic web applications and EJB applications. The source code for the test is provided in the attachment:
1. web applications, INCLUDING Two JSPs with different names for the same content and two servlets with different names for the same content. JspLoader. JSP, jspLoader2.jsp, ServletLoader, and ServletLoader2.
2. The EJB application includes a simple EJB3.0 bean, LoaderBean, and client EjbClient.
Test results:
JSPLoader. Jsp:
Level1: sun. misc. Launcher $ ExtClassLoader @ 18991b
Level2: sun. misc. Launcher $ AppClassLoader @ 18ad61
Level3: weblogic. utils. classloaders. GenericClassLoader @ a175d5 finder: weblogic. utils. classloaders. CodeGenClassFinder @ 27c1685 annotation:
Level4: weblogic. utils. classloaders. FilteringClassLoader @ 6c10df finder: weblogic. utils. classloaders. CodeGenClassFinder @ 6c1153 annotation:
Level5: weblogic. utils. classloaders. GenericClassLoader @ 6c1169 finder: weblogic. utils. classloaders. CodeGenClassFinder @ 6c11e2 annotation: TestClassLoader @
Level6: weblogic. utils. classloaders. ChangeAwareClassLoader @ 7f4e75 finder: weblogic. utils. classloaders. CodeGenClassFinder @ 7f4eea annotation: TestClassLoader@TestClassLoader.war
Level7: weblogic. servlet. jsp. TagFileClassLoader @ 816eac finder: weblogic. utils. classloaders. CodeGenClassFinder @ 816f22 annotation:
Level8: weblogic. servlet. jsp. JspClassLoader @ 1150af3 finder: weblogic. utils. classloaders. CodeGenClassFinder @ 1150b67 annotation:
SystemClassLoader: sun. misc. Launcher $ AppClassLoader @ 18ad61
JSPLoader2.Jsp:
Level1: sun. misc. Launcher $ ExtClassLoader @ 18991b
Level2: sun. misc. Launcher $ AppClassLoader @ 18ad61
Level3: weblogic. utils. classloaders. GenericClassLoader @ a175d5 finder: weblogic. utils. classloaders. CodeGenClassFinder @ 27c1685 annotation:
Level4: weblogic. utils. classloaders. FilteringClassLoader @ 6c10df finder: weblogic. utils. classloaders. CodeGenClassFinder @ 6c1153 annotation:
Level5: weblogic. utils. classloaders. GenericClassLoader @ 6c1169 finder: weblogic. utils. classloaders. CodeGenClassFinder @ 6c11e2 annotation: TestClassLoader @
Level6: weblogic. utils. classloaders. ChangeAwareClassLoader @ 7f4e75 finder: weblogic. utils. classloaders. CodeGenClassFinder @ 7f4eea annotation: TestClassLoader@TestClassLoader.war
Level7: weblogic. servlet. jsp. TagFileClassLoader @ 816eac finder: weblogic. utils. classloaders. CodeGenClassFinder @ 816f22 annotation:
Level8: weblogic. servlet. jsp. JspClassLoader @ 1150af3 finder: weblogic. utils. classloaders. CodeGenClassFinder @ 1150b67 annotation:
SystemClassLoader: sun. misc. Launcher $ AppClassLoader @ 18ad61
ServletLoader:
Level1: sun. misc. Launcher $ ExtClassLoader @ 18991b
Level2: sun. misc. Launcher $ AppClassLoader @ 18ad61
Level3: weblogic. utils. classloaders. GenericClassLoader @ a175d5 finder: weblogic. utils. classloaders. CodeGenClassFinder @ 27c1685 annotation:
Level4: weblogic. utils. classloaders. FilteringClassLoader @ 6c10df finder: weblogic. utils. classloaders. CodeGenClassFinder @ 6c1153 annotation:
Level5: weblogic. utils. classloaders. GenericClassLoader @ 6c1169 finder: weblogic. utils. classloaders. CodeGenClassFinder @ 6c11e2 annotation: TestClassLoader @
Level6: weblogic. utils. classloaders. ChangeAwareClassLoader @ 7f4e75 finder: weblogic. utils. classloaders. CodeGenClassFinder @ 7f4eea annotation: TestClassLoader@TestClassLoader.war
SystemClassLoader: sun. misc. Launcher $ AppClassLoader @ 18ad61
ServletLoader2:
Level1: sun. misc. Launcher $ ExtClassLoader @ 18991b
Level2: sun. misc. Launcher $ AppClassLoader @ 18ad61
Level3: weblogic. utils. classloaders. GenericClassLoader @ a175d5 finder: weblogic. utils. classloaders. CodeGenClassFinder @ 27c1685 annotation:
Level4: weblogic. utils. classloaders. FilteringClassLoader @ 6c10df finder: weblogic. utils. classloaders. CodeGenClassFinder @ 6c1153 annotation:
Level5: weblogic. utils. classloaders. GenericClassLoader @ 6c1169 finder: weblogic. utils. classloaders. CodeGenClassFinder @ 6c11e2 annotation: TestClassLoader @
Level6: weblogic. utils. classloaders. ChangeAwareClassLoader @ 7f4e75 finder: weblogic. utils. classloaders. CodeGenClassFinder @ 7f4eea annotation: TestClassLoader@TestClassLoader.war
SystemClassLoader: sun. misc. Launcher $ AppClassLoader @ 18ad61
EJB:
Level1: sun. misc. Launcher $ ExtClassLoader @ 18991b
Level2: sun. misc. Launcher $ AppClassLoader @ 18ad61
Level3: weblogic. utils. classloaders. GenericClassLoader @ a175d5 finder: weblogic. utils. classloaders. CodeGenClassFinder @ 27c1685 annotation:
Level4: weblogic. utils. classloaders. FilteringClassLoader @ 1e8de86 finder: weblogic. utils. classloaders. CodeGenClassFinder @ 1e8defa annotation:
Level5: weblogic. utils. classloaders. GenericClassLoader @ 1e8df10 finder: weblogic. utils. classloaders. CodeGenClassFinder @ 1e8df89 annotation: TestEJB3Loader @
SystemClassLoader: sun. misc. Launcher $ AppClassLoader @ 18ad61
First, the following conclusions are drawn from the above results:
For JSP or Servlet of the same Web application, the first six layers of classloader are the same, strictly speaking, 7 layers. Because bootstrapClassLoader has no output, This is not mentioned here ).
Two layers of Classloader, TagFileClassLoader and JspClassLoader are added to the JSP page. From the above results, we can see that each JSP file corresponds to a JspClassLoader, And the JSP page of the web application shares a TagFileClassLoader.
Let's look at EJB again. The first three layers of classloader are the same as those of the web application. Basically, GenericClassLoader is used to load the internal classes of weblogic products, and the first two layers are used to load JDK classes, the specific situation will be discussed later.
Weblogic11g p3 is also about 10.3.4 (oracle touches the weblogic version and comes with a version comparison table). It adds a class Analysis Tool Classloader Analysis Tool, which is provided in the form of web applications.
In development mode, you can use http: // host: port/wls-cat for access. It can help solve class conflicts or study the classloader structure of weblogic. Here are two articles for reference.
Http://blog.eisele.net/2011/01/using-new-weblogic-classloader-analysis.html https://blogs.oracle.com/jeffwest/entry/weblogic_1034_classloader_analysis_tool
Version comparison table
Release GA Date Pre_Sup_Ends Ext_Sup_Ends Sus_Sup_Ends
WebLogic Server 12.1.x (12c)-Dec 2011 Dec 2016 Dec 2019 Indefinite
WebLogic Server 11gR1 PS3 (10.3.4)-15 Jan 2011 Jun 2014 Jun 2017 Indefinite
WebLogic Server 11gR1 PS2 (10.3.3)-2.16l 2010 Jun 2014 Jun 2017 Indefinite
WebLogic Server 11gR1 PS1 (10.3.2)-Nov 2009 Jun 2014 Jun 2017 Indefinite
WebLogic Server 11g (10.3.1)-Jul 2009 Mar 2013 Mar 2015 Indefinite
WebLogic Server 10.3-Aug 2008 Jan 2014 Jan 2017 Indefinite
WebLogic Server 10.0-Mar 2007 Mar 2013 Mar 2015 Indefinite
WebLogic Server 9.x-Nov 2006 Nov 2011 Nov 2013 Indefinite