Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MBean not visible in Jconsole - Help needed

 
Priyadarshan Kelkar
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am running my webapp in Tomcat 6.0. I have declared a very simple MBean as follows:

package com.my.gtw;

import org.springframework.jmx.export.annotation.ManagedA ttribute;
import org.springframework.jmx.export.annotation.ManagedR esource;


@ManagedResource(objectName="bean:name=helloWorldJ MX",description="Hello World Managed Bean")
public class HelloWorldJMX {

private String message;

@ManagedAttribute(defaultValue="hello",description ="Message Attribute")
public String getMessage() {
return message;
}

public void setMessage(String message) {
this.message = message;
}

}


My app-config.xml is as follows:

<context:mbean-export />

<bean id="helloWorldMBean"
class="com.my.gtw.HelloWorldJMX"/>

When I run jconsole I do not see my MBean in the MBeans window.
Please help me .... seems to be a slip in configuration from my side.

Thanks in advance.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stupid question here, but you are having JConsole connect to the correct Process ID PID for your running Tomcat where that app is deployed? Also under the mbeans tab, remember the name you use in @ManagedResource. To there would be a menu option on the left titled "bean" The last thing there threw me off the first time I went looking for my mbeans in JConsole.

Other questions are you sure that the app is deployed and running?

Thanks

Mark
 
Priyadarshan Kelkar
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has been resolved after adding a few jmx settings in catalina.bat of Tomcat.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic