<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Class Loading on Code Log</title><link>https://codelog.me/en/tags/class-loading/</link><description>Recent content in Class Loading on Code Log</description><generator>Hugo</generator><language>en-US</language><lastBuildDate>Thu, 15 Jan 2015 11:05:51 +0800</lastBuildDate><atom:link href="https://codelog.me/en/tags/class-loading/index.xml" rel="self" type="application/rss+xml"/><item><title>JBoss AS7 Class Loading Mechanism</title><link>https://codelog.me/en/posts/class-loading-in-as7/</link><pubDate>Thu, 15 Jan 2015 11:05:51 +0800</pubDate><guid>https://codelog.me/en/posts/class-loading-in-as7/</guid><description>&lt;p&gt;Compared to earlier JBoss versions, AS7&amp;rsquo;s class loading mechanism is entirely different. AS7&amp;rsquo;s class loading is designed around JBoss modules. For an introduction to JBoss modules, see the previous article &lt;a href="http://m.com" title="JBoss Module Introduction"&gt;JBoss Module Introduction&lt;/a&gt;.&lt;/p&gt;
&lt;h1 id="implicit-module-dependencies"&gt;Implicit module dependencies&lt;/h1&gt;
&lt;p&gt;When you deploy an application to a JBoss container, some dependencies are loaded implicitly. For example, if you deploy a Java EE application that contains EJBs, since EJBs need the &lt;code&gt;Javax.ejb.*&lt;/code&gt; package and other Java EE API related packages, the JARs containing those packages are already packaged into modules and included in the container by default as part of JBoss AS, so the modules for those JARs are loaded automatically.&lt;/p&gt;
&lt;p&gt;So when are implicit module dependencies loaded? When an application is deployed to the container, it passes through a chain called the &amp;ldquo;deployment processors&amp;rdquo;. Each processor on this chain has a method to detect whether the application needs certain modules to be loaded implicitly, and if so, loads the relevant dependencies.&lt;/p&gt;</description></item><item><title>JBoss AS7 Module Introduction</title><link>https://codelog.me/en/posts/jboss-as7-module/</link><pubDate>Tue, 13 Jan 2015 16:27:00 +0800</pubDate><guid>https://codelog.me/en/posts/jboss-as7-module/</guid><description>&lt;p&gt;Compared to earlier JBoss versions, AS7&amp;rsquo;s class loading mechanism is entirely different. AS7&amp;rsquo;s class loading is designed around JBoss modules.&lt;/p&gt;
&lt;h1 id="what-is-a-module"&gt;What is a module&lt;/h1&gt;
&lt;p&gt;A module is a collection of classes and resources, and each module corresponds to a class loader. Modules can have dependencies on one another: if a JAR in one module needs to use classes from a JAR in another module, the dependency must be declared explicitly; otherwise the modules are invisible to each other. Likewise, if you deploy an application to a JBoss AS7 container and the application depends on modules, those dependencies must also be declared explicitly.&lt;/p&gt;
&lt;p&gt;If you want to understand the JBoss AS7 module loading mechanism in depth, see: &lt;a href="http://jaxenter.com/inside-the-jboss-as-7modularity-107386.html" title="JBoss Module Analysis"&gt;JBoss Module Analysis&lt;/a&gt;&lt;/p&gt;
&lt;h1 id="benefits-of-modules"&gt;Benefits of modules&lt;/h1&gt;
&lt;ol&gt;
&lt;li&gt;JARs of the same version are not loaded repeatedly.&lt;/li&gt;
&lt;li&gt;Avoids JAR version conflicts.&lt;/li&gt;
&lt;li&gt;Provides a more efficient class loading mechanism.&lt;/li&gt;
&lt;/ol&gt;</description></item></channel></rss>