Uploaded image for project: 'Wicket'
  1. Wicket
  2. WICKET-1841

Improvement to enable wicket-jmx-panel to work with MBeanServerConnection

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 1.3.4
    • None
    • wicket-jmx
    • None

    Description

      I'm attaching a patch that enables wicket-jmx-panel to work with a MBeanServerConnection (super interface of MBeanServer). This is necessary to display interact with JMX beans. The patch also enables the user to select the MBeanServer to use, which isn't possible so far.

      To illustrate the usage of my patched code, here is a simple example:

      public class Admin extends WebPage {

      @SpringBean
      private MBeanServerConnection jmxClient;

      public Admin() {
      add(new JmxPanel("jmx", JmxPanelRenderer.Tree, new JmxMBeanServerWrapper() {
      @Override protected Object load()

      { return jmxClient; }

      }));
      }

      }

      The jmxClient bean is configured via Spring, in my case with JavaConfig:

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

      To enable the rmi jmx connector on the server:

      public @Bean RmiRegistryFactoryBean rmiRegistry() throws Exception {
      return new RmiRegistryFactoryBean();
      }

      public @Bean(dependsOn="rmiRegistry") ConnectorServerFactoryBean jmxServer() throws MalformedObjectNameException {
      ConnectorServerFactoryBean factory = new ConnectorServerFactoryBean();
      factory.setObjectName("connector:name=rmi");
      factory.setServiceUrl("service:jmx:rmi://localhost/jndi/rmi://localhost:1099/tomfyweb");
      return factory;
      }

      Replacing RMI with a different connector/protocol is quite easy this way.

      Attachments

        1. wicketstuff-jmx-panel-remote.patch
          5 kB
          Jörn Zaefferer

        Activity

          People

            Unassigned Unassigned
            joern.zaefferer Jörn Zaefferer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: