Hi,

I'm working on a monitoring web application using wicket-jmx (which is
in SVN, but lacks wiki pages on wicketstuff.org and the component in
JIRA). The app to monitor is a remote application. So far wicket-jmx
does the MBeanServer lookup by itself, which I had to patch in order
to inject a MBeanServerConnection.

Attached is my patch. I had to modify the two contructors for JmxPanel
in order to inject my own JmxMBeanServerWrapper. I also had to modify
JmxMBeanServerWrapper itself to use MBeanServerConnection instead of
MBeanServer (which extends the former). MBeanServerConnection throws
IOExceptions on most methods, which I also had to catch at a few
places.

Here is some sample code to give you an idea how my modifications are used:

In my Spring JavaConfig:

public @Bean MBeanServerConnectionFactoryBean jmxClient() throws
MalformedURLException {
        MBeanServerConnectionFactoryBean factory = new
MBeanServerConnectionFactoryBean();
        
factory.setServiceUrl("service:jmx:rmi://localhost/jndi/rmi://localhost:1099/server");
        return factory;
}

My very basic admin page:

public class Admin extends Base {
        
        @SpringBean
        private MBeanServerConnection jmxClient;
        
        public Admin() {
                add(new JmxPanel("jmx", JmxPanelRenderer.Tree, new 
JmxMBeanServerWrapper() {
                        @Override protected Object load() {
                                return jmxClient;
                        }
                });
        }

}

I'd be happy to file this as a ticket in JIRA once the jmx component
is registered there.

Regards
Jörn

Reply via email to