Flylib.com

Books Software

 
 
 

Specifying a Server Configuration


Specifying a Server Configuration

JBoss is not only powerful, it's also very configurable. At the center of JBoss is a JMX microkernel that manages the MBeans that control the various services in the server. The JBoss documentation describes the microkernel as a spine, and the analogy fits well. JBoss in its minimum configuration is like the brainstem sitting at the top of the spine. It provides all the core autonomic features (to steal some thunder from IBM's autonomic computing initiative). The spinal column is the attachment point for all the MBeans that want to talk to the brainstem and to each other over the spinal cord. This architecture provides a strong backbone to build on, but at the same time it can work at its most minimal state and still do amazing things. It makes JBoss useful for everything from very small, embedded applications all the way up to full-blown enterprise server applications, all on the same spinal column.

Having a flexible architecture is pointless unless you can make use of that flexibility. JBoss provides several different configurations that range from a barebones server with no J2EE capabilities to a superserver with more services than any single application could possibly use. Figure 1-4 shows the three standard server configurations.

Developer's Notebook 1-4. Server configurations

Here are descriptions of the server configurations:


Note: There is a huge difference in the size of these configurations. The minimal configuration can start up in just a few seconds, whereas it can take nearly a minute for the all configuration to completely start on a typical developer machine.

minimal

This configuration provides the bare services you might need in the simplest application: logging, JNDI naming services, and URL deployment scanning. You'd use this setup in tight memory situations, or when you want to use JMX to control exactly which MBeans are loaded, and when and how they are loaded. This configuration doesn't provide support for EJBs, web applications, JMS, or any other high-level services. It's just a raw microkernel waiting to be molded.


default

This is a lightweight J2EE configuration; it's the one most people use. It provides most of the common J2EE services, but it doesn't include IIOP, JAXR, or clustering services, for example. These services can be added easily to this configuration.


all

This configuration includes everything in JBoss. If you need any extra services not provided in the default configuration, this is the place to start. It's often easier to start from the all configuration and take out unwanted services than to start with the default configuration and add the desired services.


Note: The all configuration includes everthing but proverbial kitchen sink.

How do I do that?

You specify a particular configuration using the -c command to the run script. To run the minimal configuration, for example, use -c minimal .

Here is an example:


Note: You can also use --configuration = minimal, if you prefer to use long configuration names .
[bin]$

./run.sh -c minimal



Creating a New Configuration

You aren't limited to the three configurations JBoss provides. In fact, instead of having unneeded services loaded, wasting memory and CPU space, you can create your own JBoss configuration that has exactly what you need. It's actually quite easy to create a custom configuration.

How do I do that?

The easiest way to create your own configuration is to copy an existing one and then rename the folder to something that describes your configuration options. Once you've done that you can add any new JARs and resources to that new server configuration folder.

Let's say you want to create a new configuration based on minimal that you can add other services to later. You can copy the minimal server configuration folder to a new folder in the server folder and call it my_server_config . On Unix this would be cp -R minimal my_server_config .

You can run your new configuration like this:

[bin]$

./run.sh -c my_server_config


The server will start up using your new configuration, and you'll see console output that looks like this:

=========================================================

      JBoss Bootstrap Environment

      JBOSS_HOME: /Users/samjr/jboss-4.0.2RC1

      JAVA: java

      JAVA_OPTS: -server -Xms128m -Xmx128m -Dprogram.name=run.sh

      CLASSPATH: /Users/samjr/jboss-4.0.2RC1/bin/run.jar:/lib/tools.jar

    =========================================================
   
    05:49:22,213 INFO  [Server] Starting JBoss (MX MicroKernel)...
    05:49:22,217 INFO  [Server] Release ID: JBoss [Zion] 4.0.2RC1 (build:
    CVSTag=JBoss_4_0_2_RC1 date=200503140913)
    05:49:22,220 INFO  [Server] Home Dir: /Users/samjr/jboss-4.0.2RC1
    05:49:22,221 INFO  [Server] Home URL: file:/Users/samjr/jboss-4.0.2RC1/
    05:49:22,223 INFO  [Server] Library URL: file:/Users/samjr/jboss-4.0.2RC1/lib/
    05:49:22,226 INFO  [Server] Patch URL: null
    05:49:22,244 INFO  [Server]

Server Name: my_server_config

05:49:22,246 INFO  [Server] Server Home Dir: /Users/samjr/jboss-4.0.
    2RC1/server/my_server_config
    05:49:22,247 INFO  [Server] Server Home URL: file:/Users/samjr/jboss-4.0.
    2RC1/server/my_server_config/
    05:49:22,249 INFO  [Server] Server Data Dir: /Users/samjr/jboss-4.0.2RC1/server/my_
    server_config/data
    05:49:22,250 INFO  [Server] Server Temp Dir: /Users/samjr/jboss-4.0.2RC1/
    server/my_server_config/tmp
    05:49:22,251 INFO  [Server] Server Config URL: file:/Users/samjr/jboss-4.0.
    2RC1/server/my_server_config/conf/
    05:49:22,285 INFO  [Server] Server Library URL: file:/Users/samjr/jboss-4.0.
    2RC1/server/my_server_config/lib/
    05:49:22,287 INFO  [Server] Root Deployment Filename: jboss-service.xml
    05:49:22,294 INFO  [Server] Starting General Purpose Architecture (GPA)...

        [More startup information]

    05:50:44,641 INFO  [Server] JBoss (MX MicroKernel) [4.0.2RC1 (build:
    CVSTag=JBoss_4_0_2_RC1 date=200503140913)] Started in 1m:21s:849ms

And with that, the new configuration is started.

What about...

...adding or removing services from the configuration?

While new configurations are nice simply as a way to work in an isolated sandbox, the original premise for creating a new configuration was to customize the set of services available. We'll need a bit more background to do that type of serious customization. But as we learn how to customize the services throughout this book, you'll be able to come back and apply those changes to your own configuration.

We hope you've seen how easy it is to get up and running and how easy it is to create new configurations of the JBoss server. The power is provided in a simple and configurable way. Congratulations for getting this far. Now let's move on to the next chapter and see how to package and deploy a simple application.