1 Reply Latest reply on Oct 12, 2002 3:35 PM by Marius Krabset

    java.io.InvalidClassException: javax.management.ObjectName

    Marius Krabset Newbie

      Hi, I have a problem with getting remote mbean-access:

      I'm trying to get info from the mbean called "jboss.system:type=ServerInfo" for monitoring purposes.

      Here is a piece of my code:

      Properties jndiProps = new Properties() ;
      jndiProps.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory" );
      jndiProps.setProperty("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces" ) ;
      jndiProps.setProperty(InitialContext.PROVIDER_URL,"jnp://localhost:1099");
      InitialContext ctx = new InitialContext(jndiProps);

      try
      {
      System.out.println("Lookup...");
      RMIAdaptor rmiAd = (RMIAdaptor) ctx.lookup( "jmx:Marius:rmi" );
      System.out.println("Got :"+rmiAd);
      ObjectName serverInfoName=new ObjectName("jboss.system:type=ServerInfo");
      boolean serverInfoIsRegistered=rmiAd.isRegistered(serverInfoName);
      System.out.println("ServerInfoIsRegistered="+serverInfoIsRegistered);
      ....
      }
      catch(...)
      {...}
      ...




      When I run this, I get:

      Buildfile: build.xml

      init:

      run:
      [java] Lookup...
      [java] Got :org.jboss.jmx.adaptor.rmi.RMIAdaptorImpl_Stub[RemoteStub [ref: [endpoint:[10.0.0.2:32920](remote),objID:[ac6a45:f0d97355c3:-8000, 3]]]]
      [java] java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
      [java] java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
      [java] java.io.InvalidClassException: javax.management.ObjectName; local class incompatible: stream classdesc serialVersionUID = -5467795090068647408, local class serialVersionUID = 2846767152916764670
      [java] at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:292)
      [java] at sun.rmi.transport.Transport$1.run(Transport.java:148)
      [java] at java.security.AccessController.doPrivileged(Native Method)
      [java] at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
      [java] at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
      [java] at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
      [java] at java.lang.Thread.run(Thread.java:536)
      [java] at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
      [java] at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
      [java] at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:133)
      [java] at org.jboss.jmx.adaptor.rmi.RMIAdaptorImpl_Stub.isRegistered(Unknown Source)
      [java] at Test.lookupConnector(Test.java:102)
      [java] at Test.(Test.java:54)
      [java] at Test.main(Test.java:41)


      I've been looking very closely at the jar-files on the server-side versus the client-side, and I can't find two different versions of the ObjectName-class.

      jdk=1.4
      jboss-version=3

      Any suggestions?

      -Marius