Java Reference
In-Depth Information
Listing 13.6
runSubscriber.bat
@echo OFF
set CLIENT_CLASS_DIR=c:\JMXbook\build
set JNDI_RESOURCE_DIR=resources
set JBOSS_DIST=d:\JBoss-2.4.4
REM Required libs to run JMS client
set CLASSPATH=%JBOSS_DIST%\client\jbossmq-client.jar
set CLASSPATH=%CLASSPATH%;%JBOSS_DIST%\client\jnp-client.jar
set CLASSPATH=%CLASSPATH%;%JBOSS_DIST%\client\jta-spec1_0_1.jar
set CLASSPATH=%CLASSPATH%;%JBOSS_DIST%\client\jboss-j2ee.jar
set CLASSPATH=%CLASSPATH%;%JBOSS_DIST%\lib\ext\oswego-concurrent.jar
set CLASSPATH=%CLASSPATH%;%JBOSS_DIST%\client\log4j.jar
set CLASSPATH=%CLASSPATH%;%JMX_HOME%\jmx\lib\jmxri.jar
set CLASSPATH=%CLASSPATH%;%JMX_HOME%\jmx\lib\jmxtools.jar
set CLASSPATH=%CLASSPATH%;%JMX_HOME%\contrib
\remoting\jar\jmx_remoting.jar
set CLASSPATH=%CLASSPATH%;%JBOSS_DIST%\lib\ext\jboss-j2ee.jar
set CLASSPATH=%CLASSPATH%;% CLIENT_CLASS_DIR %\build
REM Aggregated classpath
set CLASSPATH=%CLASSPATH%;%CLIENT_CLASS_DIR%;%JNDI_RESOURCE_DIR%
echo "Running with classpath %CLASSPATH%"
%JAVA_HOME%\bin\java -classpath %CLASSPATH% jmxbook.ch3.JMXBookAgent
In the previous listing (and the following), you should replace the variables
JMX_HOME
with the values for your specific environment.
Executing this script starts the agent with the proper
JAR
s to enable your
MBean to subscribe and publish to the
JMS
message bus in the JBoss server. You
will notice a reference to the
JAR
files in the JBoss distribution. After running the
JMX
agent, you need to register the MBean in the agent. The following com-
mand does this:
java jmxbook.ch13.JMSSetup
You should now have the JBoss
J2EE
application server running in one window
and
JMXBookAgent
in a second window. The MBean you wrote should be sub-
scribed to the topics in which it is interested. The output from your
JMX
agent
console will look like that shown in figure 13.5.
The
JMS
bus is operational, your agent is running your MBean, and the
MBean is subscribed to the control messages. The next thing you need to do is to
run the debugger subscriber that simulates the
IR
signal transmitter.