Hi ,
I have to access certain MBeans that secured by basic auth on jmx-console. I can access them using a standalone client as decribed
here : http://www.len.ro/2006/12/jmx-invocation-with-secured-console/
Here is how it has worked for me till now :
I have a standalone java client that I start up with a -Djava.security.auth.login.config=<path_to_auth_conf>
The auth.conf has no new entires and its the default one that is present in the default/conf
I create the CallBackHandler with the user and pwd and set the LoginContext
LoginContext lc = new LoginContext("jmx-console", handler); //have tried "other" also .
lc.login();
Hashtable env =
new Hashtable();String factory = "
org.jnp.interfaces.NamingContextFactory";env.put(Context.
INITIAL_CONTEXT_FACTORY, factory);env.put(Context.
PROVIDER_URL, jndiUrl);env.put(Context.
SECURITY_CREDENTIALS, pw);env.put(Context.
SECURITY_PRINCIPAL, userId);
Context ctx =
new InitialContext(env);
mbeanServer = (MBeanServerConnection) ctx.lookup("jmx/invoker/RMIAdaptor");
Using the above I am able to connect.
When I try the *same* code from within a servlet it doesnt work.
I get a principal=null for the domain error , which I think indicates that the user credentials are not getting passed.
Is there any other setting that i have to do in order to connect to a secured JMX server from *within* another JBOSS server ?
Any changes in user.properties , role.properties ? , any change in the auth-conf ?
I dont know what changes to make to my local JBoss instance so that the servlet deployed in it can talk to remote JMX MBeans,
Any guidance and hints are highly appreciated !!
thanks
Pat