I had configured username/password for
JMX-CONSOLE and this when i open my jmx-console from browser it is asking for credentials and working correctly.similarly when try to validate the same scenario using java program,it's not the same.i want to stop the process when given credentials are wrong.here i am placing my sample code.
Hashtable objHashTable = new Hashtable();
objHashTable.put(Context.PROVIDER_URL,
strBuffAdminProviderURL.toString());
objHashTable.put("java.naming.security.principal", "sdfafd");
objHashTable.put("java.naming.security.credentials", "afdf");
objHashTable.put(Context.INITIAL_CONTEXT_FACTORY,
JBossConstants.INITIAL_CONTEXT_FACTORY_VALUE);
InitialContext objInitContext = new InitialContext(objHashTable);
RMIAdaptor objrmiadap =(RMIAdaptor) objInitContext.lookup("jmx/rmi/RMIAdaptor");
MBeanServer server=new RMIConnectorImpl(objrmiadap);