O'Reilly logo

JBoss at Work: A Practical Guide by Scott Davis, Tom Marrs

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Appendix A. ClassLoaders and JBoss

When a Java application references Java classes, the Java Virtual Machine (JVM) uses a ClassLoader to load them into memory. The Delegation Model was introduced in Java 2 and organizes ClassLoaders into the following tree/hierarchy by using parent/child relationships, as shown in Figure A-1.

Standard J2SE ClassLoader hierarchy
Figure A-1. Standard J2SE ClassLoader hierarchy

The J2SE ClassLoaders do the following:

  • The Bootstrap (also called the primordial) ClassLoader has no parent, is the root of the ClassLoader tree, and loads core Java classes (java.*) into the JVM.

  • The Extension ClassLoader loads extension classes:

    • Classes that extend core Java classes—javax.*.

    • Classes from the Java Runtime Environment (JRE) lib/ext directory in the standard J2SE installation.

  • The System (also called the Application) ClassLoader loads classes and JARs from the system CLASSPATH—the CLASSPATH environment variable and the classpath argument on the java command line.

If the current ClassLoader previously loaded a class, then the ClassLoader returns the class to the client. If a class has not been previously loaded, then according to the Java specification, a ClassLoader must defer (or delegate) to its parent before trying to load the class itself. For example, if an application references java.lang.String, the System ClassLoader delegates to the Extension ClassLoader, which in turn defers to the Bootstrap ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required