2 Replies Latest reply on Jun 25, 2004 1:59 AM by Srikanth Kondeti

    java.io.NotSerializableException while getting dom3.Element

    Srikanth Kondeti Newbie

      Hi,
      I want to get the ConfigElement in jboss.web:service=WebServer for reading Tomcat configuration.
      But i get the following exception - " java.io.NotSerializableException: org.apache.xerces.dom.NodeListCache"
      ------------------------------------------------------------------------------------------------------------
      after lookup org.jboss.invocation.jrmp.interfaces
      JRMPInvokerProxy@10a2d64 class name $Proxy1
      Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
      at $Proxy1.getAttribute(Unknown Source)
      at Jboss323Test.main(Jboss323Test.java:98)
      Caused by: java.io.NotSerializableException: org.apache.xerces.dom.NodeListCache
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1304)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
      at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:367)
      at org.apache.xerces.dom.NodeImpl.writeObject(NodeImpl.java:1281)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:809)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1296)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
      at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:367)
      at org.apache.xerces.dom.NodeImpl.writeObject(NodeImpl.java:1281)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:809)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1296)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
      at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:367)
      at org.apache.xerces.dom.NodeImpl.writeObject(NodeImpl.java:1281)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:809)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1296)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
      at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1332)
      at java.io.ObjectOutputStream.defaultWriteObject(ObjectOutputStream.java:367)
      at org.apache.xerces.dom.NodeImpl.writeObject(NodeImpl.java:1281)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at java.io.ObjectStreamClass.invokeWriteObject(ObjectStreamClass.java:809)
      at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1296)
      at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1247)
      at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
      at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
      at java.rmi.MarshalledObject.(MarshalledObject.java:92)
      at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:371)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:324)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
      at sun.rmi.transport.Transport$1.run(Transport.java:148)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      at java.lang.Thread.run(Thread.java:534)
      at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
      at org.jboss.invocation.jrmp.server.JRMPInvoker_Stub.invoke(Unknown Source)
      at org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy.invoke(JRMPInvokerProxy.java:135)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:96)
      at org.jboss.jmx.connector.invoker.client.InvokerAdaptorClientInterceptor.invoke(InvokerAdaptorClientInterceptor.java:58)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:45)
      at org.jboss.proxy.ClientMethodInterceptor.invoke(ClientMethodInterceptor.java:55)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:85)
      ... 2 more

      ------------------------------------------------------------------------------------------------------------

      How do i solve this problem ?
      I use the fllowing code

      ------------------------------------------------------------------------------------------------------------
      import javax.naming.Context;
      import javax.naming.InitialContext;
      import javax.naming.NamingEnumeration;
      import java.util.Properties;
      import java.util.*;
      import java.net.*;
      import org.jnp.interfaces.*;
      import javax.rmi.PortableRemoteObject;
      import org.jboss.jmx.adaptor.rmi.*;
      import javax.management.*;
      import org.w3c.dom.Element;

      public class Jboss323Test {
      public static void main(String[] args) throws Exception {

      Properties env = new Properties();
      env.setProperty(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
      env.setProperty(Context.PROVIDER_URL, "jnp://172.16.0.167:1099");
      InitialContext ctx = new InitialContext(env);
      System.out.println("After creating IC "+ ctx.toString());
      Object objpl = null;
      NamingContext nc = null;
      NamingEnumeration ne = null;
      objpl = ctx.lookup("jmx/invoker/RMIAdaptor");
      System.out.println("after lookup "+objpl.toString()+" class name "+objpl.getClass().getName());
      RMIAdaptor rad = (RMIAdaptor)PortableRemoteObject.narrow(objpl,RMIAdaptor.class);
      Set nameS = rad.queryNames(new ObjectName("jboss.web:service=WebServer"),null);
      Iterator itr = nameS.iterator();
      ObjectName name = (ObjectName)itr.next();
      Element ele = (Element) rad.getAttribute(name,"Config");
      System.out.println("Element "+ele.toString());
      }
      }
      -----------------------------------------------------------------------------------------------------------

      Is there any round about way getting the dom3.Element

      Regards,
      Viswa