Wednesday, November 28, 2007

Connecting jconsole to JBoss JMX server

So I was working on integrating the JBI ant tasks to the Open ESB distribution for JBoss and I was having some issues connecting to the JMX server. So, I wanted to try something simple and see if I could connect jconsole to the JMX server first. Out of the box this does not work. You will have to add some system properties to your run.sh or run.bat file for this to work. It's pretty simple really, but took me a while to find. For this to work just add the following properties to you run.sh file:


# Enable the jconsole agent remotely on port 64850
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=64850"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"


Next, start JBoss and once it is started you can start jconsole by issuing the command jconosle from a command window. You can connect in one of three ways. If you are connecting locally just select the local tab, you will see the PID and the class for JBoss and select Connect. If you are connecting to remotely select the remote tab and enter the Host/IP and the Port (the one you entered in your run.sh file).

6 comments:

Anonymous said...

Hi chad,

Thanks for ur helpful guidance, but i am sorry to say u that I am not able to connect to my jboss server using jconsole.
My configuration in the run.sh file is as follows.

# Enable the jconsole agent remotely on port 12345
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.port=12345"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.authenticate=false"
JAVA_OPTS="$JAVA_OPTS -Dcom.sun.management.jmxremote.ssl=false"

chad, pls tell if I have remained with any configuration .

Thanks
Sumeet jaju

Dinesh Gupta said...

Hi,
Please let me know that how can I see a particular class & memory consume by this class.
Suppose that I want to see the HttpSession memory info In JBOSS

Chad Gallemore said...

I'm not sure connecting to jconsole will allow you to profile a specific class and it's memory usage. You might try and connect some sort of profiler to you app.

דן לויסון said...

When adding the jmxremote options I am getting the following exception:
2009-06-18 14:27:08,203 ERROR [com.my6sense.server.session.SessionManagerBean] failed to attach to session service
java.lang.RuntimeException: Error creating MBeanProxy: my6sense:service=UserSessionService
at org.jboss.mx.util.MBeanProxyExt.init(MBeanProxyExt.java:415)
at

Are you familiar with such a problem?

Mayank said...

It worked for me on Jboss as 5.
I wanted to know how to set up password for remote jconsole login.

Mayank said...

It worked for me on JBoss as 5.
Could you let me know how can I set up the password for jconsole login.