Java Tutorial - Java Scipt : Standalone JBossMQ

Java Tutorial - Java Scipt :

Standalone JBossMQ


The default JBoss distribution seems to include everything but the kitchen sink. There are times when all we want or need is a JMS provider. In those cases, the footprint required for a complete JBoss installation is overkill. The flexibility of JBoss is one of its strongest selling points. JBoss was designed to be highly modular, and it is even possible to decompose it down to a tiny microkernel that fits only a single floppy. We won’t be doing anything that drastic, but we will be configuring JBoss down to a minimal useful configuration for JBossMQ, the JMS provider.
We will start with the default server configuration, which is contained in the server/default directory within the JBoss home directory. Copy the entire directory, and rename it server/jbossmq. This will make a replica of the
default configuration. Now, we’ll remove the unnecessary services from the server/jbossmq/ deploy directory. The list below shows the files that we need. Everything else should be deleted from this directory.
·         counter-service.xml
·         hsqldb-service.xml
·         jboss-local-jdbc.rar
·         jbossmq-destinations-service.xml
·         jbossmq-service.xml
·         jboss-xa.rar
·         jca-service.xml
·         jms-ra.rar
·         jms-service.xml
·         properties-service.xml
·         schedule-manager-service.xml
·         scheduler-service.xml
·         user-service.xml
Next we need to clean up the server/jbossmq/lib directory to remove unused library jars. Once again, the list below represents the files that should remain. Unlike the previous step, this one is not strictly necessary. Everything
will work properly even if we have extra library jars loaded. It will waste resources and result in a memory footprint that is approximately 3 MB larger than necessary.

·         activation.jar
·         autonumber-plugin.jar
·         bcel.jar
·         counter-plugin.jar
·         hsqldb.jar
·         hsqldb-plugin.jar
·         jboss.rar
·         jboss-j2ee.jar
·         jboss-jaas.jar
·         jboss-jca.jar
·         jboss-management.jar
·         jbossmq.jar
·         jbossmx.jar
·         jbosssx.jar
·         jnpserver.jar
·         jsse.jar
·         jts.jar
·         log4j.jar
·         properties-plugin.jar
Finally, we need to modify the server/jbossmq/conf/jboss-service .xml file. This is an XML configuration file that tells JBoss which services to start up. If you’ll recall, JBoss uses a JMX core to make it easy to add, remove,
and configure services. This file contains references to the JMX MBeans that JBoss uses. In order to disable some of the services we don’t want, we must make some changes here. Most notable among the deleted services are the EJB
container, the servlet container, and the Web server. Find the following elements and delete them from the jboss-service .xml file:
·         Approximately line 105:
<mbean code=”org.jboss.web.WebService”
name=”jboss:service=Webserver”
·         Approximately line 199:
                       <mbean code=”org.jboss.ejb.EJBDeployer”
                        name=”jboss.ejb:service=EJBDeployer”>
·         Approximately line 208:
                        <mbean code=”org.jboss.deployment.EARDeployer”
                         name=”jboss.j2ee:service=EARDeployer”>
·         Approximately line 239:
                       <mbean code=”org.jboss.invocation.jrmp.server.JRMPInvoker”
                         name=”jboss:service=invoker,type=jrmp”>
·         Approximately line 244:
                       <mbean code=”org.jboss.invocation.pooled.server.PooledInvoker”
                         name=”jboss:service=invoker,type=pooled”>
·         Approximately line 248:
                        <mbean code=”org.jboss.invocation.local.LocalInvoker”
                          name=”jboss:service=invoker,type=local”>
The configuration is complete! To start the standalone JBossMQ server, you must pass the server configuration in the start script. In Windows, the run.bat script is used: %JBOSS_HOME%\bin\run.bat –c jbossmq
On Linux, we will use the run.sh script: $JBOSS_HOME/bin/run.sh –c jbossmq The examples in the following section will work with the standalone JBossMQ. However, the JMX console will not be available because that service was removed.