Hi there,
Here is the snipset of the code:
String objName = "jboss.j2ee:module=KTJAR.jar,service=EjbModule";
MBeanInfo mbeanInfo = connection.getMBeanInfo(new ObjectName(objName));
Set mbeans = connection.queryMBeans(new ObjectName(objName), null);
Object attrValue = connection.getAttribute(new ObjectName(objName), "Containers");
if (attrValue instanceof Collection) {
Object[] attrs = ((Collection) attrValue).toArray();
for(int i = 0; i < attrs.length; i++) {
if (attrs instanceof StatelessSessionContainer) {
System.out.println(((StatelessSessionContainer) attrs).getName());
}
}
}
The connection is an instance of MBeanServerConnection and created by RMIAdaptor.
When I execute this code, I always get this exception:
java.io.NotSerializableException: org.jboss.ejb.StatelessSessionContainer
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
...
Anything I've done wrong? Or this code couldn't be executed at client side?
My purpose is trying to get the StatelessSessionContainer MBean, and use this MBean to get org.jboss.metadata.BeanMetaData, am I wrong by doing this? Is there an easy way to achieve this?
Your help is apprecitated! and thanks in advance,
Yueming
In general JMX objects will have attributes that are not serializable and cannot be accessed remotely.