Re: [JMX] org.apache.catalina.session.StandardManager not serializable
Hi, Using Tomcat 5.5.27 with JDK 1.5.0_11, I'm trying to retrieve the attribute manager from the MBean Catalina:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//localhost/. But I'm getting thre following error. Exception in thread main java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.apache.catalina.session.StandardManager at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:157) at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source) at javax.management.remote.rmi.RMIConnectionImpl_Stub.getAttribute(Unknown Source) at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.getAttribute(RMIConnector.java:857) at test.jmx.JmxTest.main(JmxTest.java:37) Caused by: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.apache.catalina.session.StandardManager at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1309) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348) at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:290) at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:139) ... 4 more Caused by: java.io.NotSerializableException: org.apache.catalina.session.StandardManager at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1081) at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:302) at sun.rmi.server.UnicastRef.marshalValue(UnicastRef.java:258) at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:304) at sun.rmi.transport.Transport$1.run(Transport.java:153) at java.security.AccessController.doPrivileged(Native Method) at sun.rmi.transport.Transport.serviceCall(Transport.java: 149) at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:466) at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:707) at java.lang.Thread.run(Thread.java:595) I attach to this mail a sample that able to reproduce this. In fact I would like to know how to retrieve this Class, I hope that this class implement Serializable otherwise I don't know why StandardManager is exposed as Jmx Attribute. Additionnaly, when I try to retrieve an attribute like managedResource from the MBean Catalina:host=localhost,type=Host. I got the following execption Exception in thread main java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.apache.catalina.util.LifecycleSupport at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:157) at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source) at javax.management.remote.rmi.RMIConnectionImpl_Stub.getAttribute(Unknown Source) at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.getAttribute(RMIConnector.java:857) at test.jmx.JmxTest.main(JmxTest.java:36) see attached file for complete stacktrace. Regards, Emmanuel /** * */ package test.jmx; import java.util.Hashtable; import javax.management.MBeanServerConnection; import javax.management.ObjectName; import javax.management.remote.JMXConnector; import javax.management.remote.JMXConnectorFactory; import javax.management.remote.JMXServiceURL; import org.apache.catalina.Manager; /** * @author xbi0bnv * */ public class JmxTest { /** * @param args */ public static void main(String[] args) throws Exception { JMXServiceURL serviceURL = new JMXServiceURL(service:jmx:rmi:///jndi/rmi://localhost:21205/jmxrmi); Hashtable h = new Hashtable(); h.put(JMXConnector.CREDENTIALS, new String[] { controlRole, tomcat }); JMXConnector connector = JMXConnectorFactory.connect(serviceURL, h); MBeanServerConnection connection = connector.getMBeanServerConnection(); ObjectName oName = new ObjectName(Catalina:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//localhost/); Manager manager = (Manager) connection.getAttribute(oName, manager); System.out.println(manager.getInfo()); } } Exception in thread main java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.apache.catalina.util.LifecycleSupport at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:157) at com.sun.jmx.remote.internal.PRef.invoke(Unknown Source) at javax.management.remote.rmi.RMIConnectionImpl_Stub.getAttribute(Unknown Source) at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.getAttribute(RMIConnector.java:857) at test.jmx.JmxTest.main(JmxTest.java:36) Caused by: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.apache.catalina.util.LifecycleSupport at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1309) at
RE: [JMX] org.apache.catalina.session.StandardManager not serializable
From: Emmanuel Soden [mailto:[EMAIL PROTECTED] Subject: Re: [JMX] org.apache.catalina.session.StandardManager not serializable Using Tomcat 5.5.27 with JDK 1.5.0_11, I'm trying to retrieve the attribute manager from the MBean Catalina:J2EEApplication=none,J2EEServer=none, j2eeType=WebModule,name=//localhost/. I don't think there's any requirement for any app to guarantee that attributes are serializable, and I suspect trying to make StandardManager so would create a host of issues inside Tomcat. Perhaps you should try retrieving the attributes you're interested in from this JMX location instead: Catalina:type=Manager,path=/,host=localhost Its attributes are all retrievable, at least according to JConsole. when I try to retrieve an attribute like managedResource from the MBean Catalina:host=localhost,type=Host From a brief perusal of the 6.0 code (sorry, not the level you're using), there appears to be extremely limited use of the managedResource attribute, despite its presence in most of the MBeans. Looks like in the vast majority of cases, the attribute is never set. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [JMX] org.apache.catalina.session.StandardManager not serializable
Caldarale, Charles R wrote: From: Emmanuel Soden [mailto:[EMAIL PROTECTED] Subject: Re: [JMX] org.apache.catalina.session.StandardManager not serializable Using Tomcat 5.5.27 with JDK 1.5.0_11, I'm trying to retrieve the attribute manager from the MBean Catalina:J2EEApplication=none,J2EEServer=none, j2eeType=WebModule,name=//localhost/. I don't think there's any requirement for any app to guarantee that attributes are serializable, and I suspect trying to make StandardManager so would create a host of issues inside Tomcat. Perhaps you should try retrieving the attributes you're interested in from this JMX location instead: Catalina:type=Manager,path=/,host=localhost Its attributes are all retrievable, at least according to JConsole when I try to retrieve an attribute like managedResource from the MBean Catalina:host=localhost,type=Host From a brief perusal of the 6.0 code (sorry, not the level you're using), there appears to be extremely limited use of the managedResource attribute, despite its presence in most of the MBeans. Looks like in the vast majority of cases, the attribute is never set. More generally I have had cases where I've had an attribute exposed via JMX for /in-process /usage that then blows chunks with out-of-process usage. This should be avoided, but where it cannot be it should be documented as the way things are and possibly addressed by replaceObject(). [In my recent case I used replaceObject() to replace my non-serializable data with an approximation thereof whose toString() would show something somewhat meaningful in a remote JMX console.] -- Jess Holle
Re: [JMX] org.apache.catalina.session.StandardManager not serializable
Thank you Chuck, What I understand know is that, you can only retrieve primitive values. In the same way, I was trying to retrieve a org.apache.catalina.Context from the MBean Catalina:J2EEApplication=none,J2EEServer=none,j2eeType=WebModule,name=//localhost/ using the JMX operation operation findMappingObject and I get the following error Caused by: java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.io.WriteAbortedException: writing aborted; java.io.NotSerializableException: org.apache.catalina.util.LifecycleSupport 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.invoke(Unknown Source) at javax.management.remote.rmi.RMIConnector$RemoteMBeanServerConnection.invoke(Unknown Source) My suggestion: - If you want to expose a JMX object all of their attributes or operations have to be serializable. - Provide a different set of interface for Remote JMX connection and local JMX connection. - Add to the documentation a list of objects that can be retrieved Regards, Emmanuel On 11/4/08, Caldarale, Charles R [EMAIL PROTECTED] wrote: From: Emmanuel Soden [mailto:[EMAIL PROTECTED] Subject: Re: [JMX] org.apache.catalina.session.StandardManager not serializable Using Tomcat 5.5.27 with JDK 1.5.0_11, I'm trying to retrieve the attribute manager from the MBean Catalina:J2EEApplication=none,J2EEServer=none, j2eeType=WebModule,name=//localhost/. I don't think there's any requirement for any app to guarantee that attributes are serializable, and I suspect trying to make StandardManager so would create a host of issues inside Tomcat. Perhaps you should try retrieving the attributes you're interested in from this JMX location instead: Catalina:type=Manager,path=/,host=localhost Its attributes are all retrievable, at least according to JConsole. when I try to retrieve an attribute like managedResource from the MBean Catalina:host=localhost,type=Host From a brief perusal of the 6.0 code (sorry, not the level you're using), there appears to be extremely limited use of the managedResource attribute, despite its presence in most of the MBeans. Looks like in the vast majority of cases, the attribute is never set. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]