1 Reply Latest reply on Mar 16, 2006 1:24 PM by plutus

    How to access secured JMX connection in JBoss from client? H

    plutus Newbie

      Hi,

      I am using JBoss 3.2.5

      and I secured JMX access (jmx-invoker-adaptor-server.jar/META-INF/jboss-service.xml):

      <!-- Uncomment to require authenticated users -->







      Problem: Now I get no more access to JBoss JMX.

      I Use the follwing code to access JMX. Without security I had no problem!


      props.put(Context.INITIAL_CONTEXT_FACTORY,
      "org.jnp.interfaces.NamingContextFactory");
      props.put(Context.PROVIDER_URL, url);
      props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");

      // BEGIN: I've ADDED THIS, BUT CODE DOES NOT WORK. user/pass is a valid combination (is ok for jmx-console login!)
      props.put(Context.SECURITY_PRINCIPAL, "user");
      props.put(Context.SECURITY_CREDENTIALS, "pass");
      // END

      Context ctx = new InitialContext(props);

      RMIAdaptor rmiAdaptor = (RMIAdaptor) ctx.lookup("jmx/rmi/RMIAdaptor");
      RMIConnectorImpl impl = new RMIConnectorImpl(rmiAdaptor);
      conn = (MBeanServer) impl;
      ctx.close();
      // ...


      Please Help,
      thx a lot
      Marcel

        • 1. Re: How to access secured JMX connection in JBoss from clien
          plutus Newbie

          Hm,
          with following piece of code it works. But why? could anyone please give me a link to a section where this is documented?


          props.put(Context.INITIAL_CONTEXT_FACTORY,
          "org.jnp.interfaces.NamingContextFactory");
          props.put(Context.PROVIDER_URL, url);
          props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");

          // BEGIN
          SecurityAssociation.setPrincipal(new SimplePrincipal("user"));
          SecurityAssociation.setCredential("pass".toCharArray());
          // END

          Context ctx = new InitialContext(props);

          RMIAdaptor rmiAdaptor = (RMIAdaptor) ctx.lookup("jmx/rmi/RMIAdaptor");
          RMIConnectorImpl impl = new RMIConnectorImpl(rmiAdaptor);
          conn = (MBeanServer) impl;
          ctx.close();
          // ...