1 Reply Latest reply on Nov 1, 2012 7:35 AM by Darran Lofthouse

    MBeans Secure Client

    akash bansal Newbie

      Pls. help me.


      I have several MBeans packaged as SAR file which are deployed in JBoss 7.1 server. Now I want to invoke their methods in Secure Context. i.e. if any client wants to invoke one of the methods of MBeans calling client should supply credentials. But JBoss 7.1 is letting the client invoke MBeans functions even if client does not provide credentials. Belw is my Client Code:

      import java.io.IOException;


      import javax.management.AttributeNotFoundException;

      import javax.management.InstanceAlreadyExistsException;

      import javax.management.InstanceNotFoundException;

      import javax.management.MBeanException;

      import javax.management.MBeanServerConnection;

      import javax.management.MalformedObjectNameException;

      import javax.management.NotCompliantMBeanException;

      import javax.management.ObjectName;

      import javax.management.ReflectionException;

      import javax.management.remote.JMXConnector;

      import javax.management.remote.JMXConnectorFactory;

      import javax.management.remote.JMXServiceURL;


      public class MBeanClient {

          public static void main(String[] args) throws MalformedObjectNameException, NullPointerException, IOException,

                  AttributeNotFoundException, InstanceNotFoundException, MBeanException, ReflectionException,

                  InstanceAlreadyExistsException, NotCompliantMBeanException {


      //        code to invoke MBean

              JMXServiceURL serviceURL1 = new JMXServiceURL("service:jmx:remoting-jmx://localhost:4447");

              JMXConnector jmxConnector1 = JMXConnectorFactory.connect(serviceURL1, null);

              MBeanServerConnection connection1 = jmxConnector1.getMBeanServerConnection();

              ObjectName mbeanObject = new ObjectName("service.server.monitor:service=MyMonitor");

              connection1.invoke(mbeanObject, "updateFrequence", new String[]{"910"}, new String[]{"java.lang.String"});





      I have also attached my mbeans code.

        • 1. Re: MBeans Secure Client
          Darran Lofthouse Master

          As you are connecting locally authentication is silently taking place to verify that the client is local to the AS server.  Try listening on a public interface and using the client remotely and you should see the use of a username and password being mandatory.

          1 of 1 people found this helpful