Once there is confidence that the MBean will function on the platform, deploying the MBean inside of a standard JMX Agent is the next step. Included are instructions for deploying to JBoss.
Ensure a current version of java development kit (v1.4.x), see above.
JAVA_HOME is set (JBoss
JAVA_HOME/bin is in the
PATH (You will NOT need to set your
CLASSPATH, nor will you need any of the jars used in the
Ensure a current version of JBoss (v4.0RC1 or better)
http://www.jboss.org/index.html select "Downloads" select "jboss-4.0.zip" pick a mirror unzip ~/dload/jboss-4.0.zip create a JBOSS_HOME environment variable set to the unzipped directory unix only: cd $JBOSS_HOME/bin chmod +x *.sh
Deploy (copy) the
mxjtest.war directory in
mysqld-service.xml file in
<?xml version="1.0" encoding="UTF-8"?> <server> <mbean code="com.mysql.management.jmx.jboss.JBossMysqldDynamicMBean" name="mysql:type=service,name=mysqld"> <attribute name="datadir">/tmp/xxx_data_xxx</attribute> <attribute name="autostart">true</attribute> </mbean> </server>
On unix: $JBOSS_HOME/bin/run.sh
On windows: %JBOSS_HOME%\bin\run.bat
Be ready: JBoss sends a lot of output to the screen.
When JBoss seems to have stopped sending output to the
screen, open a web browser to:
Scroll down to the bottom of the page in the
mysql section, select the bulleted
Observe the JMX MBean View page. MySQL should already be running.
(If "autostart=true" was set, you may skip this step.)
Scroll to the bottom of the screen. You may press the
Invoke button to stop (or start)
Operation completed successfully
without a return value. Click
To confirm MySQL is running, open a web browser to
http://localhost:8080/mxjtest/ and you
should see that the following query:
returned with the following result:
Guided by the
you will be able to use MySQL in your Web Application. There
test database and a
root user (no password) ready to
experiment with. Try creating a table, inserting some rows,
and doing some selects.
Shut down MySQL. MySQL will be stopped automatically when
JBoss is stopped, or: from the browser, scroll down to the
bottom of the MBean View press the stop service
Invoke button to halt the service.
Operation completed successfully without a
return value. Using
task manager see that MySQL is no longer
As of 1.0.6-beta version is the ability to have the MBean start the MySQL database upon start up. Also, we've taken advantage of the JBoss life-cycle extension methods so that the database will gracefully shut down when JBoss is shutdown.