Show Table of Contents
5.4. Using JMX as a Microkernel
When JBoss starts up, one of the first steps performed is to create an MBean server instance (
javax.management.MBeanServer). The JMX MBean server in the JBoss architecture plays the role of a microkernel. All other manageable MBean components are plugged into JBoss by registering with the MBean server. The kernel in that sense is only an framework, and not a source of actual functionality. The functionality is provided by MBeans, and in fact all major JBoss components are manageable MBeans interconnected through the MBean server.
5.4.1. The Startup Process
In this section we will describe the JBoss server startup process. A summary of the steps that occur during the JBoss server startup sequence is:
- The run start script initiates the boot sequence using the
org.jboss.Main.main(String[])method entry point. - The
Main.mainmethod creates a thread group namedjbossand then starts a thread belonging to this thread group. This thread invokes the Main.boot method. - The
Main.bootmethod processes theMain.mainarguments and then creates anorg.jboss.system.server.ServerLoaderusing the system properties along with any additional properties specified as arguments. - The XML parser libraries,
jboss-jmx.jar,concurrent.jarand extra libraries and classpaths given as arguments are registered with theServerLoader. - The JBoss server instance is created using the
ServerLoader.load(ClassLoader)method with the current thread context class loader passed in as theClassLoaderargument. The returned server instance is an implementation of theorg.jboss.system.server.Serverinterface. The creation of the server instance entails:- Creating a
java.net.URLClassLoaderwith the URLs of the jars and directories registered with theServerLoader. ThisURLClassLoaderuses theClassLoaderpassed in as its parent and it is pushed as the thread context class loader. - The class name of the implementation of the
Serverinterface to use is determined by thejboss.server.typeproperty. This defaults toorg.jboss.system.server.ServerImpl. - The
Serverimplementation class is loaded using theURLClassLoadercreated in step 6 and instantiated using its no-arg constructor. The thread context class loader present on entry into theServerLoader.loadmethod is restored and the server instance is returned.
- The server instance is initialized with the properties passed to the
ServerLoaderconstructor using theServer.init(Properties)method. - The server instance is then started using the
Server.start()method. The default implementation performs the following steps:- Set the thread context class loader to the class loader used to load the
ServerImplclass. - Create an
MBeanServerunder thejbossdomain using theMBeanServerFactory.createMBeanServer(String)method. - Register the
ServerImplandServerConfigImplMBeans with the MBean server. - Initialize the unified class loader repository to contain all JARs in the optional patch directory as well as the server configuration file conf directory, for example,
server/production/conf. For each JAR and directory anorg.jboss.mx.loading.UnifiedClassLoaderis created and registered with the unified repository. One of theseUnifiedClassLoaderis then set as the thread context class loader. This effectively makes allUnifiedClassLoaders available through the thread context class loader. - The
org.jboss.system.ServiceControllerMBean is created. TheServiceControllermanages the JBoss MBean services life cycle. We will discuss the JBoss MBean services notion in detail in Section 5.4.2, “JBoss MBean Services”. - The
org.jboss.deployment.MainDeployeris created and started. TheMainDeployermanages deployment dependencies and directing deployments to the correct deployer. - The
org.jboss.deployment.JARDeployeris created and started. TheJARDeployerhandles the deployment of JARs that are simple library JARs. - The
org.jboss.deployment.SARDeployeris created and started. The SARDeployer handles the deployment of JBoss MBean services. - The
MainDeployeris invoked to deploy the services defined in theconf/jboss-service.xmlof the current server file set. - Restore the thread context class loader.
The JBoss server starts out as nothing more than a container for the JMX MBean server, and then loads its personality based on the services defined in the
jboss-service.xml MBean configuration file from the named configuration set passed to the server on the command line. Because MBeans define the functionality of a JBoss server instance, it is important to understand how the core JBoss MBeans are written, and how you should integrate your existing services into JBoss using MBeans. This is the topic of the next section.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.