HelloWorld with JConsole and the Websphere Service Integration Bus

Sander Hautvast

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.loginSource=properties
com.ibm.CORBA.loginUserid=<your websphere username>
com.ibm.CORBA.loginPassword=<your password>

Then start WAS_HOME/java/bin/jconsole using the following options:

-J-Djava.class.path=WAS_HOME/java/lib/tools.jar;WAS_HOME/runtimes/com.ibm.ws.admin.client_6.1.0.jar
-J-Djava.naming.factory.initial=com.ibm.websphere.naming.WsnInitialContextFactory
-J-Dcom.ibm.CORBA.ConfigURL=file:WAS_HOME/profiles/dmgr01/properties/sas.client.props
-J-Dcom.ibm.SSL.ConfigURL=file:WAS_HOME/profiles/dmgr01/properties/ssl.client.props

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.

the bus definition

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.

hi world

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.

Comments (9)

  1. Pooyan Farahani - Reply

    April 2, 2009 at 12:29 pm

    Hi,

    Thanks for the useful article. Actually, I've been trying to access WAS 7 or 6 by a similar JMX console named jManage, no joy so far! FYI, I run the jManage on websphere's jdk. I am wondering whether you have any suggestion for that?

    Many thanks,
    Pooyan

    • Sander Hautvast - Reply

      April 3, 2009 at 2:17 pm

      Hi Pooyan,
      I don't know jmanage, but equal settings should be applied. Like running in the IBM runtime, the mentioned config files and service url. NB. Disabling security in websphere is a way to make things easier for JMX clients, so you could try that first.

  2. Pooyan Farahani - Reply

    April 20, 2009 at 1:12 pm

    Hi Sander,

    Thanks for your reply, I managed to get JManage working with Websphere 7. I could be done by using IBM's JDK like as you mentioned for JConsole and then using JSR160 as JMX communication protocol and then copying across com.ibm.ws.admin.client_7.0.0.jar to the lib folder of JManage. Like JConsole, should set the location of sasclient.props for the java runner.

    Regards,
    Pooyan

  3. michal - Reply

    December 15, 2009 at 10:54 am

    hiya,
    if anyone was wondering - for WAS v7 the jndi factory initial context class is:
    com.ibm.ws.naming.util.WsnInitCtxFactory

    (the package was missing 'util').

  4. michal - Reply

    December 16, 2009 at 9:05 am

    well - i followed all the steps (except i'm using websphere 7 - so there are slight differences) - and i think everything goes through allright. except it does not allow me connect with jconsole.
    it asks me to accept the server certificate, i can see in the server's log files that user+psswd go through fine.
    however - i still won't let me connect. is there any additional settings for the jconsole to be granted access? i managed to connect to WSv6 some time ago (however - it most probably didn't have security enabled).
    anything that comes to your mind?

    ps.
    the actual class is in the util package, but for some reason you need to leave it w/o in the variable.

  5. michal - Reply

    December 16, 2009 at 9:22 am

    the output of jconsole window is (however - i do get a prompt asking me for credentials):

    Decc 16, 2009 9:16:28 AM null null
    AUDIT: security.LoadSCI
    Dec 16, 2009 9:16:29 AM null null
    AUDIT: security.GettingConfig
    Dec 16, 2009 9:16:29 AM null null
    WARNING: ssl.default.password.in.use.CWPKI0041W
    Dec 16, 2009 9:16:29 AM null null
    INFO: ssl.disable.url.hostname.verification.CWPKI0027I
    Dec 16, 2009 9:16:29 AM null null
    AUDIT: security.AuthTarget
    Dec 16, 2009 9:16:29 AM null null
    AUDIT: security.ClientCSI
    Dec 16, 2009 9:16:46 AM null null
    WARNING: jndiUnavailCommErr
    Dec 16, 2009 9:16:46 AM null null
    SEVERE: security.securityserver.error
    Dec 16, 2009 9:16:54 AM null null
    WARNING: jndiUnavailCommErr
    Dec 16, 2009 9:16:54 AM null null
    SEVERE: security.securityserver.error
    Dec 16, 2009 9:16:54 AM null null
    SEVERE: security.JSAS0240E
    Dec 16, 2009 9:16:54 AM null null
    WARNING: jndiNamingException
    Dec 16, 2009 9:17:02 AM null null
    WARNING: jndiUnavailCommErr
    Dec 16, 2009 9:17:02 AM null null
    SEVERE: security.securityserver.error
    Dec 16, 2009 9:17:02 AM null null
    SEVERE: security.JSAS0240E
    Dec 16, 2009 9:17:02 AM null null
    WARNING: jndiNamingException
    Dec 16, 2009 9:17:02 AM null null
    AUDIT: security.LoadSCI
    Dec 16, 2009 9:17:02 AM null null
    AUDIT: security.ClientCSI
    Dec 16, 2009 9:17:04 AM null null
    WARNING: jndiUnavailCommErr

  6. Vikas - Reply

    January 10, 2011 at 10:06 pm

    Thank you for this article. I was always getting an access denied exception and was wondering why. I was able to get rid of AccesDeniedException once I did this. Thanks again!!!

  7. Mohan - Reply

    November 3, 2011 at 5:21 pm

    I have tried so many sites to configure jconsole to work with WAS7.0, but without success. This is one of the best and elegant instruction I have seen to far, and yes, the instructions worked like a charm. Thanks a ton.

  8. Swavek - Reply

    June 6, 2013 at 6:24 pm

    Thank you for this post. Finally I got past the AcccessDenied issue. However to view some of the results form invoking operations (HAManager) I needed to add one more jar to the classpath.

    C:\WebSphere_70\AppServer\plugins\com.ibm.ws.runtime.jar

Add a Comment