Announcement Announcement Module
Collapse
No announcement yet.
Some MBeans do, some MBeans don't... Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Some MBeans do, some MBeans don't...

    Here's something odd: I'm working with Spring's JMX support for the first time today (very impressive), and it's working great for the first two beans I've exposed. But now I'm exposing two or three more, and the new one's don't show up in JConsole.

    I'm running my app within Tomcat 6, and using JConsole to sniff 'em out. Here's a snippet of my spring config:

    Code:
    <!-- JMX -->
    <context:mbean-export />
    
    <bean id="registry" class="org.springframework.remoting.rmi.RmiRegistryFactoryBean">
      <property name="port" value="1099"/>
    </bean>
    <bean id="serverConnector"
        class="org.springframework.jmx.support.ConnectorServerFactoryBean">
     <property name="objectName" value="connector:name=rmi"/>
     <property name="serviceUrl" 
    	            value="service:jmx:rmi://localhost/jndi/rmi://localhost:1099/myconnector"/>
    	</bean>
    You can see here I'm all setup for remote access, not that I'm using it at present. Now here is a snippet of some code from one of my beans that appears correctly in JConsole:

    Code:
    @Component
    @ManagedResource(
    	objectName="OreTestBench:name=loggingLevelController", 
    	description="Lets you control the logging level", 
    	log=false )
    public class Log4jMBean {
    
    	@ManagedOperation(description="Set logging to INFO level")
        public void activateInfo(String category) {
            LogManager.getLogger(category).setLevel(Level.INFO);
        }
    
    }
    ...You can tell I'm using jdk 5+ and relying on an @Component annotation in this case to register the bean. The Spring annotations for @ManagedResource, @ManagedOperation, and @ManagedAttribute seem to be working just fine...

    ...And here is a snippet of some code from one of my beans that does not appear in JConsole:

    Code:
    @ManagedResource(
    		objectName="OreTestBench:name=MessageDrivenPojo", 
    		description="Lets you control the Main MDPOJO", 
    		log=false )
    public class JmsMessageListener implements MessageListener {
     boolean			bypassAll	=	false;
    
     @ManagedAttribute(description="true=bypass" )	
     public boolean isBypassAll() {		return bypassAll;	}
    
     @ManagedAttribute(description="true=bypass" )
     public void setBypassAll(boolean bypassAll) {	
       this.bypassAll = bypassAll;	
     }
    Some of my beans have @ManagedAttributes, some have @ManagedOperations, , and some have both, but that doesn't seem to have an affect. Some of my beans are defined within the Spring config, some are defined with the @Component annotations, but that doesn't seem to have an affect either. I'm sure I've missed something here. But I can't figure out what.

    This isn't really high priority, but I'm wondering if anyone could offer some ideas.

    Thanks in advance,
    Ken
Working...
X