Version 8

    The RMI Adaptor allows you to access the JBoss MBeanServer remotely.  It also allows you to access the MBeanServer from the same JVM, serializing MBeanServer calls, with moderate overhead.  Assuming you have jndi.properties configured properly to point to JBoss, the following will retrieve the MBeanServer for you.

     

    Note that objects must be serializable for them to be transmitted through the MBeanServer interface.

     

    import javax.management.ObjectName;
    import javax.management.MBeanServerConnection;
    import javax.naming.InitialContext;
    
    public class PrintVersion {
    
        public static void main(String args[]) throws Exception {
           MBeanServerConnection server;
           server = (MBeanServerConnection)new InitialContext().lookup("jmx/rmi/RMIAdaptor");
           ObjectName on = new ObjectName("jboss.system:type=Server");
           Object ver = server.getAttribute(on, "Version");
           System.out.println("Version " + ver);
        }
    
    }
    

     

    In the classpath, you can have either:

      • jbossall-client.jar

      • or jboss-jmx.jar AND jmx-invoker-adaptor-client.jar