Following are the jar files in my classpath:
1)com.ibm.ws.admin.client_6.1.0.jar
2)com.ibm.ws.webservices.thinclient_6.1.0.jar
3)ibmorb.jar
4)management.jar
5)pmij2ee.jar
I was able to create a connection with the Application Server and then Query for the JVM MBean as well. But while calling the getAttribute method for the JVM MBean as shown below:
mbsc.getAttribute(mbean,"heapSize");
I received following error on above line:
javax.management.JMRuntimeException:
>> SERVER (id=4773e3aa, host=01hw107573) TRACE START:
>> javax.management.JMRuntimeException: ADMN0022E: Access is denied for the getStats operation on JVM MBean because of insufficient or empty credentials.
>> at com.ibm.ws.management.AdminServiceImpl.preInvoke(AdminServiceImpl.java:2119)
>> at com.ibm.ws.management.AdminServiceImpl.preInvoke(AdminServiceImpl.java:1766)
>> at com.ibm.ws.management.AdminServiceImpl.preInvoke(AdminServiceImpl.java:1694)
>> at com.ibm.ws.management.AdminServiceImpl.preInvoke(AdminServiceImpl.java:1667)
>> at com.ibm.ws.management.AdminServiceImpl.getAttribute(AdminServiceImpl.java:661)
>> at com.ibm.ws.management.remote.AdminServiceForwarder.getAttribute(AdminServiceForwarder.java:135)
>> at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1400)
>> at javax.management.remote.rmi.RMIConnectionImpl.access$100(RMIConnectionImpl.java:96)
>> at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1260)
>> at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1356)
>> at javax.management.remote.rmi.RMIConnectionImpl.getAttribute(RMIConnectionImpl.java:612)
>> at javax.management.remote.rmi._RMIConnectionImpl_Tie.getAttribute(_RMIConnectionImpl_Tie.java:576)
>> at javax.management.remote.rmi._RMIConnectionImpl_Tie._invoke(_RMIConnectionImpl_Tie.java:97)
>> at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:613)
>> at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:466)
>> at com.ibm.rmi.iiop.ORB.process(ORB.java:503)
>> at com.ibm.CORBA.iiop.ORB.process(ORB.java:1552)
>> at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2673)
>> at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2551)
>> at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:62)
>> at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:95)
>> at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1498)
>> SERVER (id=4773e3aa, host=01hw107573) TRACE END.
at com.ibm.ws.management.AdminServiceImpl.preInvoke(AdminServiceImpl.java:2119)
at com.ibm.ws.management.AdminServiceImpl.preInvoke(AdminServiceImpl.java:1766)
at com.ibm.ws.management.AdminServiceImpl.preInvoke(AdminServiceImpl.java:1694)
at com.ibm.ws.management.AdminServiceImpl.preInvoke(AdminServiceImpl.java:1667)
at com.ibm.ws.management.AdminServiceImpl.getAttribute(AdminServiceImpl.java:661)
at com.ibm.ws.management.remote.AdminServiceForwarder.getAttribute(AdminServiceForwarder.java:135)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1400)
at javax.management.remote.rmi.RMIConnectionImpl.access$100(RMIConnectionImpl.java:96)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1260)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1356)
at javax.management.remote.rmi.RMIConnectionImpl.getAttribute(RMIConnectionImpl.java:612)
at javax.management.remote.rmi._RMIConnectionImpl_Tie.getAttribute(_RMIConnectionImpl_Tie.java:576)
at javax.management.remote.rmi._RMIConnectionImpl_Tie._invoke(_RMIConnectionImpl_Tie.java:97)
at com.ibm.CORBA.iiop.ServerDelegate.dispatchInvokeHandler(ServerDelegate.java:613)
at com.ibm.CORBA.iiop.ServerDelegate.dispatch(ServerDelegate.java:466)
at com.ibm.rmi.iiop.ORB.process(ORB.java:503)
at com.ibm.CORBA.iiop.ORB.process(ORB.java:1552)
at com.ibm.rmi.iiop.Connection.respondTo(Connection.java:2673)
at com.ibm.rmi.iiop.Connection.doWork(Connection.java:2551)
at com.ibm.rmi.iiop.WorkUnitImpl.doWork(WorkUnitImpl.java:62)
at com.ibm.ejs.oa.pool.PooledThread.run(ThreadPool.java:95)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1498)
I have given the proper username and password in the HashTable as mentioned in the sample example.
Can any one please help me with that.
I've always had better luck using SOAP instead of RMI, not only for
the security side but also because I feel that SOAP is more resilient.
Have you searched for the ADMN0022E error? I see quite a few topics by
just running "RMI ADMN0022E" in Google.
Wkr,
Sven Vermeulen
[snip]
>
> I have given the proper username and password in the HashTable as mentioned in the sample example.
> Can any one please help me with that.
>
It doesn't look like you have used the proper username & password, or a
keyfile is incorrect or something. Note that Query will work without
credentials, but using the MBean will fail.
Ken
The username and password are correct and have Administrator role assigned to it.
Please let me know, in case i have missed out something.
Thanks in advance.
Reetesh,
I've never used this particular API, what I've used is the following,
which uses the com.ibm.websphere.management.AdminClient.
Ken
public AdminClient getSecureAdminClient(String host, String port,
String user, String password) throws ConnectorException {
AdminClient ac = null;
Properties props = System.getProperties();
props.setProperty(AdminClient.CONNECTOR_TYPE,
AdminClient.CONNECTOR_TYPE_SOAP);
props.setProperty(AdminClient.CONNECTOR_HOST, host);
props.setProperty(AdminClient.CONNECTOR_PORT, port);
props.setProperty(AdminClient.PASSWORD, password);
props.setProperty(AdminClient.USERNAME, user);
props.setProperty(AdminClient.CONNECTOR_SECURITY_ENABLED, "true");
props.setProperty("javax.net.ssl.trustStore","/opt/WebSphere/ND6/profiles/default/etc/DummyClientTrustFile.jks");
props.setProperty("javax.net.ssl.keyStore","/opt/WebSphere/ND6/profiles/default/etc/DummyClientKeyFile.jks");
props.setProperty("javax.net.ssl.trustStorePassword","WebAS");
props.setProperty("javax.net.ssl.keyStorePassword","WebAS");
try {
ac = AdminClientFactory.createAdminClient(props);
} catch (ConnectorException e) {
//new AdminException(ex).printStackTrace();
System.err.println(getClass().getName() + ".getAdminClient()
Exception: " + e);
throw e;
}
return ac;
}
I have already tried this AdminClient approach as well, but got the same error.
It works well if i disable Admin Security from the Admin Console.
While debugging, i tried getting the properties object for the created Admin Client using adminClient.getConnectorProperties();
Then i tried getting the values for AdminClient.USERNAME and AdminClient.PASSWORD and it returned me null.
So i guess, the username password that i am setting while creating AdminClient object are not set properly. m stuck with it for quiet sometime now.
Any pointers for probable cause?
This code works with security enabled. Really really sounds like you're
using the wrong userid/pw combo.
Ken
The User id that i am passing while creating AdminClient is created using Admin console under Users and Groups->Manage Users. I have given this user Administrator Role. And the password that i am providing is also correct.
I am using WAS 6.1.
This user is in your WAS user registry ?
I used the appclient install.
Ken
If i have missed out could you please tell me where can i recheck the user being added in the repository?
Hi reetesh.....,
Hi....
I also want to use the standard JMX Remoting API (Jsr 160) to connect
to the jmx server.
I m running sample code which u r running from below IBM link..
http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/tjmx_customjava_jsr160.html
But when I m trying to connect it throws following exceptions...:(
java.io.IOException: Failed to retrieve RMIServer stub:
javax.naming.NameNotFoun
dException: Context: manoriDCNode01Cell/nodes/manoriDCNode01/servers/
server1, na
me: JMXConnector: First component in name JMXConnector not found.
[Root exceptio
n is org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/
CosNaming/Nami
ngContext/NotFound:1.0]
Then I copied adminclient.jar and ibmorb.jar and orb.properties file
to classpath from websphere installtion and it worked well for me..:)
but thats not standard way bcoz...i guess its using websphere classes
and interfaces.......
Can u tell me wat it means by standard way of connecting to jmx
server....?
Any help greatly appreciated..
Thanks,
Nihil
To manage users and groups, either federated repositories must be the current realm definition or the current realm definition configuration must match the federated repositories configuration. If you use Lightweight Directory Access Protocol (LDAP), configure both the federated repositories and standalone LDAP registry configurations to use the same LDAP server.