4 Replies Latest reply on Mar 3, 2003 12:36 PM by roysun

    Remotely query mbean

    roysun Newbie

      I am trying the example in the 3.x book for querying mbean remotely using the following code

      RMIAdaptor adaptor = (RMIAdaptor) ctx.lookup(adaptorName);
      System.out.println("adaptor = " + adaptor);

      RemoteMBeanServer server = new RMIConnectorImpl(adaptor);
      System.out.println("removeMBeanServer = " + server.toString());

      Integer count = server.getMBeanCount();
      System.out.println("count = " + count);

      String domain = server.getDefaultDomain();
      System.out.println("domain = " + domain);

      Set set = server.queryMBeans(new ObjectName("jboss:service=JNDIView"),null);
      System.out.println("set = "+ set);

      I can get count and domain which are seems good.
      But server.queryMBeans(new ObjectName("jboss:service=JNDIView"),null) gives me exceptions.

      Roy

      ==

      adaptor = org.jboss.jmx.adaptor.rmi.RMIAdaptorImpl_Stub[RemoteStub [ref: [endpoint:[10.0.5.3:50920](remote),objID:[df1832:f3a1488933:-8000, 3]]]]
      removeMBeanServer = org.jboss.jmx.connector.rmi.RMIConnectorImpl@121f1d
      count = 215
      domain = jboss

      java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
      java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
      java.io.InvalidClassException: javax.management.ObjectName; local class incompatible: stream classdesc serialVersionUID = -5467795090068647408, local class serialVersionUID = 2846767152916764670
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
      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:536)
      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.jmx.adaptor.rmi.RMIAdaptorImpl_Stub.queryMBeans(Unknown Source)
      at org.jboss.jmx.connector.rmi.RMIConnectorImpl.queryMBeans(RMIConnectorImpl.java:321)
      at com.inquent.iqos.service.writer.WriterTest.main(WriterTest.java:75)
      Caused by: java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
      java.io.InvalidClassException: javax.management.ObjectName; local class incompatible: stream classdesc serialVersionUID = -5467795090068647408, local class serialVersionUID = 2846767152916764670
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:249)
      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:536)
      Caused by: java.io.InvalidClassException: javax.management.ObjectName; local class incompatible: stream classdesc serialVersionUID = -5467795090068647408, local class serialVersionUID = 2846767152916764670
      at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:459)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1521)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1435)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
      at sun.rmi.server.UnicastRef.unmarshalValue(UnicastRef.java:297)
      at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:246)
      ... 6 more
      set = null
      java.rmi.UnmarshalException: Error unmarshaling return; nested exception is:
      java.net.SocketException: Connection reset by peer: JVM_recv in socket input stream read
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:217)
      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
      at org.jboss.jmx.adaptor.rmi.RMIAdaptorImpl_Stub.invoke(Unknown Source)
      at org.jboss.jmx.connector.rmi.RMIConnectorImpl.invoke(RMIConnectorImpl.java:459)
      at com.inquent.iqos.service.writer.WriterTest.main(WriterTest.java:78)
      Caused by: java.net.SocketException: Connection reset by peer: JVM_recv in socket input stream read
      at java.net.SocketInputStream.socketRead0(Native Method)
      at java.net.SocketInputStream.read(SocketInputStream.java:116)
      at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
      at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
      at java.io.ObjectInputStream$PeekInputStream.peek(ObjectInputStream.java:2118)
      at java.io.ObjectInputStream$BlockDataInputStream.peek(ObjectInputStream.java:2411)
      at java.io.ObjectInputStream$BlockDataInputStream.peekByte(ObjectInputStream.java:2421)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1235)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1830)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1756)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1636)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1264)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1830)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1756)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1636)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1264)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1830)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1756)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1636)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1264)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:322)
      at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:215)
      ... 4 more