The experience of reading app Class Loader

Source: Internet
Author: User

Some thoughts on App Class Loader
"This article's main reference article Appclassloader's author is the famous Java Vision boss Robbin"

I have not seen the Java depth adventure, but also how many have heard about class loader discussion, read Robbin wrote the app Class loader article deep experience, here with their own words to sum up a little.

The operation of a Java system allows the simultaneous presence of different JVM Class loader, and understanding the relationship between different loader is critical, as shown in the following figure

APP Class Loader
|-----EJB Class Loader
|-----Web App Class Loader

The APP class loader level is globally visible, and its two loader are only locally effective and non-interference.

The loading order for APP Class loader is jre/lib/* => jre/lib/ext/* => jre/classes/* =>

The loading range of Web App Class Loader is in web-inf/lib/* and web-inf/classes/*
They will be in the loading range to start looking for and call into the required class/jar/lib, if the failure of the loading responsibility to the app Class Loader, which is called the class Loader inheritance relationship

The loading scope of the EJB Class Loader is limited to the jar or ear range. APP server creates an instance of EJB class loader for each EJB package file, for example: When you publish Hello.jar, World.jar two jars, the system creates two instances of EJB class loader, To load these two EJB packets, so Hello.jar does not see any files other than itself. Also, if you want to invoke the name of a class library other than the jar package, you need to define Class-path:log4j.jar in the manifest file of the jar bundle Hibernate2.jar

This article explains that you may be a little unfamiliar class loader also has hierarchical inheritance relationship, the visability of usable classes/jars is defined by the class loader and all its ance Stors. This concept is very important in the Java EE, need to understand well.

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.