Friday 11 December 2009

Creating Custom JMX MBeans within Weblogic

I've spent the last few days looking at setting up a custom MBean within a Weblogic (9.2) server so that I have a way of calling a method and forcing initialisation of a service which is deployed as part of an ear file.

I followed the blog on the oracle site here: http://blogs.oracle.com/WebLogicServer/2009/10/developing_custom_mbeans_to_ma.html

This works fine up to the point of deployment. However there is then the issue of actually calling the MBean and invoking the operation...
I've tried to follow the blog's instructions of using jconsole with no success.
I then moved on to trying to do it via the weblogic WLST command-line tool. So far as I can see the command-line tool only recognises attributes NOT operations!

After another hunt around the web I've cobbled together the instructions to do it via jconsole.

The changes can be made via the Admin console found at http://localhost:7001/console (assuming the server is on localhost and using port 7001).

To login you will need the username/password configured during the domain creation.

  1. Click on the server you wish to edit, then the protocol tab then IIOP. Ensure enable IIOP is selected and also add in a username and password. It doesn't matter what these values are but it needs them to be set even when using anonymous access!
  2. Save and activate changes.
  3. Restart the server.



Now load jconsole and enter the following URL into the advanced tab:

service:jmx:rmi:///jndi/iiop://localhost:7001/weblogic.management.mbeanservers.runtime



Select connect and navigate to your MBean and select the operation tab as follows:



I'll continue to look at the WLST side of things next week but at least this is a start!