HelloWorld with JConsole and the Websphere Service Integration Bus
A colleague asked me whether jconsole could connect to a running IBM Webpshere 6.1 instance. This way you could gather performance data and work with Mbeans like with any other 1.5+ JVM. I had never tried this, but I quickly saw that jconsole is provided with the websphere jvm, so I said I would give it a try.
The forum posts all complained that it wasn´t possible, but I combining several entries I got together a working solution. This is typical of websphere, it´s a little harder, but in the end you can get there.
So what do you do? You´ll probably need a local websphere 6.1 installation, because it´s easier to use a websphere JVM to connect to a server. In this example I have done this.
First go to WAS_HOME/profiles/dmgr01/properties/sas.client.props and set the following properties (assuming you have security enabled):
com.ibm.CORBA.loginUserid=<your websphere username>
Then start WAS_HOME/java/bin/jconsole using the following options:
Fill in WAS_HOME your self and mind the semicolon on unix!
dmgr01 is my deployment manager profile
The -J gives you the opportunity to enter any standard JVM option, so jconsole -J-Xmx500M
would be the way to set the heap to 500Mb.
Then the gui pops up. Go to the advanced tab and enter
service:jmx:iiop://[host]:[port]/jndi/JMXConnector where port is the bootstrap port for the deployment manager. Connect without entering credentials (they´re already in the file)
NB. You´ll have to watch your command shell, because it may prompt you to add the SSL certificate signer to the trust store.
What you then get is a slightly different jconsole. It only shows you the tab containing the available mbeans instead of all monitoring like options a Sun jvm offers out of the box (like cpu heap and usage counters). Instead you have all the mbeans needed to manage the cell. Every function in be it in the web console or wsadmin can be found here. This is all really neat, but not actually helpful, because you already had administrative tools. Let´s think of something useful.
Managing the SI Bus.
Through Mbeans you can also do things not available in the console. Like manage messages in queues.
So I set up a Service Integration Bus (using the webconsole), defined a queue and set up JMS resources: a queue reference to the bus queue and a queue connection factory. Bus member was my application server.
Next I connected the console to the application server (being the bus member). Look up the bootstrap port (typically 2809) and replace it in the JMXConnector url. The bus is not a separate process in websphere. Instead the messaging engine becomes part of a server or cluster when it is added as a busmember.
In the server1JMSBasicfunction Mbean there´s an enqueue operation that I used to put the message “hi world” on the queue. Another Mbean called server1BasicAdministration contains a browse operation. Et voila.
All this would be a a quick way to set up tests for Message Driven Beans for example. You could write also unit tests that call the Mbean to do the same.