I m trying to get attributes of a mbean.
Set set = server.queryMBeans(new ObjectName("com.sun.appserv:type=jvm,category=monitor,*"),null);
String[] attrlist={"uptime-name", "uptime-lastsampletime", "heapsize-highwatermark", "heapsize-description"};
Iterator it = set.iterator();
ObjectName oname = null;
ObjectInstance ois = null;
while(it.hasNext())
{
ois = (ObjectInstance)it.next();
oname = ois.getObjectName();
AttributeList attr=(AttributeList)server.getAttributes(oname,attrlist);
}
I get exception
java.rmi.UnmarshalException: Error unmarshaling return; nested exception is:
java.lang.ClassNotFoundException: com.sun.enterprise.admin.common.exception.AFRuntimeException (no security manager: RMI class loader disabled)
20 Aug 2009 11:53:58:637 at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:227)
20 Aug 2009 11:53:58:637 at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:142)
20 Aug 2009 11:53:58:637 at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
20 Aug 2009 11:53:58:637 at javax.management.remote.rmi.RMIConnectionImpl_Stub.getAttributes(Unknown Source)
20 Aug 2009 11:53:58:637 at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.getAttributes(RMIConnector.java:903)
When i keep appserv-rt.jar from glassfish and keep it in classpath
./../working/jre/bin/java -cp .:./appserv-rt.jar GlassFishConnect
I get this exception
Exception while fetching attribute Server Configuration Bad.
com.sun.enterprise.admin.common.exception.AFRuntimeException: Server Configuration Bad.
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.checkHotConfigChanges(SunoneInterceptor.java:518)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.getAttributes(SunoneInterceptor.java:336)
at com.sun.enterprise.interceptor.DynamicInterceptor.getAttributes(DynamicInterceptor.java:228)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1407)
at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:72)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1264)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1359)
at javax.management.remote.rmi.RMIConnectionImpl.getAttributes(RMIConnectionImpl.java:636)
at sun.reflect.GeneratedMethodAccessor137.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Unknown Source)
at sun.rmi.transport.StreamRemoteCall.executeCall(Unknown Source)
at sun.rmi.server.UnicastRef.invoke(Unknown Source)
at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source)
at javax.management.remote.rmi.RMIConnectionImpl_Stub.getAttributes(Unknown Source)
at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.getAttributes(Unknown Source)
at com.adventnet.appmanager.server.jdk15.glassfish.GlassFishDataCollector.getAttributesOfStandalone(GlassFishDataCollector.java:514)
at com.adventnet.appmanager.server.jdk15.glassfish.GlassFishDataCollector.getMBeansindomaindata(GlassFishDataCollector.java:505)
at com.adventnet.appmanager.server.jdk15.glassfish.GlassFishDataCollector.getJMXdata(GlassFishDataCollector.java:447)
at com.adventnet.appmanager.server.jdk15.glassfish.GlassFishDataCollector.main(GlassFishDataCollector.java:424)
Caused by: javax.management.InstanceNotFoundException: com.sun.appserv:type=server-instance,name=hotfix-pcr1
at com.sun.enterprise.admin.server.core.jmx.storage.PersistenceChecker.findElement(PersistenceChecker.java:128)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.manufactureMBean(SunoneInterceptor.java:716)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.manufactureAndRegisterMBean(SunoneInterceptor.java:656)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.registerWithPersistenceCheck(SunoneInterceptor.java:692)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:302)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.checkHotConfigChanges(SunoneInterceptor.java:504)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.getAttributes(SunoneInterceptor.java:336)
at com.sun.enterprise.interceptor.DynamicInterceptor.getAttributes(DynamicInterceptor.java:228)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1407)
at javax.management.remote.rmi.RMIConnectionImpl.access$200(RMIConnectionImpl.java:72)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1264)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1359)
at javax.management.remote.rmi.RMIConnectionImpl.getAttributes(RMIConnectionImpl.java:636)
at sun.reflect.GeneratedMethodAccessor137.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
[Message sent by forum member 'psramkumar' (ram_jack_27_at_yahoo.com)]
http://forums.java.net/jive/thread.jspa?messageID=365011