< Previous | Front page | Next >
Skip to end of metadata
Go to start of metadata

From JBoss EWS 2.1.0, the Tomcat6 and 7 will include a component called StoreConfig. It is a component that can let users to persist the server runtime configuration changes into configuration files. JBoss JON uses it to manage Tomcat servers. In this article, I'd like to give a brief introduction to StoreConfig.

The StoreConfig component is jar that will be placed into Tomcat's 'lib' directory:

Please note Tomcat 6 and Tomcat 7 are using different versions of storeconfig. Because their configurations to be dealt with have differences. As the bash command show above, in Tomcat 7 it's using tomcat7-storeconfig-0.0.1.Alpha3-redhat-5.jar.

To enable StoreConfig, we need to add a line in server.xml:

The StoreConfig is exposed as MBeans at runtime, so to use it, we need to enable JMX during Tomcat startup. To achieve this, we need to set 'CATALINA_OPTS' properly:

Then we can start Tomcat server:

To access StoreConfig, we can use 'jconsole' to connect to Tomcat JMX port:

From JConsole, we can see the StoreConfig is in 'Catalina:StoreConfig' category, and it contains multiple operations:

We can try to click 'storeConfig' operation and it's like this:

And from the tomcat log file 'catalina.out' we can see the StoreConfig actions:

From the log we can see the server configuration files are saved.

Now we can have a look at the design of Storeconfig. The Storeconfig is written as MBeans and registered into Tomcat as a Listener in Tomcat's configuration file 'server.xml':

We can have a look at the source code of StoreConfigLifecycleListener to see how it's implemented:

I've trimmed the code a little bit, the import method is 'createMBean' which will register Storeconfig mbeans into Tomcat. We can see this part of code:

This is the process how the mbeans are registered into 'Catalina:type=StoreConfig" category. The descriptions of mbeans for StoreConfig are in the mbeans-descriptor.xml file:

This is the scheme used by Tomcat. There is a reference document to introduce 'mbeans-descriptor.xml' on Tomcat website: MBean Descriptor How To

This is how StoreConfig registered into Tomcat. If you are interested in how to write MBeans for Tomcat, here is an excellent introduction article: MBeans and Tomcat: A HOWTO Guide for Managing YOUR Application

Now let's dig a little bit in Tomcat source code to see how it support Storeconfig:

Above are codes in org.apache.catalina.core.StandardServer if Tomcat 7.0.54. We can see the Tomcat server will use Storeconfig to store its configurations if StoreConfig is present.

Labels:
jboss jboss Delete
ews ews Delete
tomcat tomcat Delete
storeconfig storeconfig Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.