JBoss.org Community Documentation
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.main
method creates a thread group named jboss
and then starts a thread belonging to this thread group. This thread invokes the Main.boot method.
The Main.boot
method processes the Main.main
arguments and then creates an org.jboss.system.server.ServerLoader
using the system properties along with any additional properties specified as arguments.
The XML parser libraries, jboss-jmx.jar
, concurrent.jar
and extra libraries and classpaths given as arguments are registered with the ServerLoader
.
The JBoss server instance is created using the ServerLoader.load(ClassLoader)
method with the current thread context class loader passed in as the ClassLoader
argument. The returned server instance is an implementation of the org.jboss.system.server.Server
interface. The creation of the server instance entails:
Creating a java.net.URLClassLoader
with the URLs of the jars and directories registered with the ServerLoader
. This URLClassLoader
uses the ClassLoader
passed in as its parent and it is pushed as the thread context class loader.
The class name of the implementation of the Server
interface to use is determined by the jboss.server.type
property. This defaults to org.jboss.system.server.ServerImpl
.
The Server
implementation class is loaded using the URLClassLoader
created in step 6 and instantiated using its no-arg constructor. The thread context class loader present on entry into the ServerLoader.load
method is restored and the server instance is returned.
The server instance is initialized with the properties passed to the ServerLoader
constructor using the Server.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 ServerImpl
class.
Create an MBeanServer
under the jboss
domain using the MBeanServerFactory.createMBeanServer(String)
method.
Register the ServerImpl
and ServerConfigImpl
MBeans 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 an org.jboss.mx.loading.UnifiedClassLoader
is created and registered with the unified repository. One of these UnifiedClassLoader
is then set as the thread context class loader. This effectively makes all UnifiedClassLoader
s available through the thread context class loader.
The org.jboss.system.ServiceController
MBean is created. The ServiceController
manages the JBoss MBean services life cycle. We will discuss the JBoss MBean services notion in detail in Section 3.4.2, “JBoss MBean Services”.
The org.jboss.deployment.MainDeployer
is created and started. The MainDeployer
manages deployment dependencies and directing deployments to the correct deployer.
The org.jboss.deployment.JARDeployer
is created and started. The JARDeployer
handles the deployment of JARs that are simple library JARs.
The org.jboss.deployment.SARDeployer
is created and started. The SARDeployer handles the deployment of JBoss MBean services.
The MainDeployer
is invoked to deploy the services defined in the conf/jboss-service.xml
of 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.