1 Reply Latest reply on Feb 21, 2008 10:59 AM by Andrew Rubinger

    EJB3 an JBoss client java.io.InvalidClassException

    wilfried deguil Newbie

      Hello,

      I start to develop with EJB3. I'm using JBoss 4.2.1.GA. I deploy my Entity and Session Bean on the server. I verify that my session bean at loaded with the JMX console.

      Code of my Session Bean :


      @Stateful
      public class SiteDetailsManagerBean implements SiteDetailsManagerRemote {
      @PersistenceContext
      private EntityManager em;
      private int id;
      private String label;
      private String securityLevel;
      public SiteDetailsManagerBean(int id,String label) {
      }
      ...
      }

      code of my interface Session bean :

      @Remote
      public interface SiteDetailsManagerRemote {
      void createSite(String label);
      void removeSite(int siteId);
      SiteDetailsManagerBean getSite(int siteId);
      List getAllSites();
      public void testReponse(String str);
      }

      code of my client :

      public class Client {
      private static SiteDetailsManagerRemote siteDetailsMngrRequest;
      private static void getRemoteRequest() throws Exception
      {
      if (null != siteDetailsMngrRequest){ return ; }
      String JNDINameRemote = "SiteDetailsManagerBean/remote" ;
      Context context = new InitialContext();
      siteDetailsMngrRequest = (SiteDetailsManagerRemote)context.lookup(JNDINameRemote); }
      public Client(String[] args) { }

      public static void main(String[] args) {...}



      So when I start my client, on the red line I get this exception :


      javax.naming.NamingException: Could not dereference object [Root exception is java.lang.reflect.UndeclaredThrowableException]
      at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1152)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:707)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
      at javax.naming.InitialContext.lookup(Unknown Source)
      at fr.horoquartz.client.Client.getRemoteRequest(Client.java:27)
      at fr.horoquartz.client.Client.main(Client.java:42)
      Caused by: java.lang.reflect.UndeclaredThrowableException
      at $Proxy0.createProxy(Unknown Source)
      at org.jboss.ejb3.JndiProxyFactory.getObjectInstance(JndiProxyFactory.java:53)
      at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
      at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1127)
      at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1144)
      ... 5 more
      Caused by: java.rmi.MarshalException: Failed to communicate. Problem during marshalling/unmarshalling; nested exception is:
      java.io.InvalidClassException: org.jboss.ejb3.remoting.BaseRemoteProxy; local class incompatible: stream classdesc serialVersionUID = 1126421850898582900, local class serialVersionUID = -2711693270411201590
      at org.jboss.remoting.transport.socket.SocketClientInvoker.handleException(SocketClientInvoker.java:122)
      at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:646)
      at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
      at org.jboss.remoting.Client.invoke(Client.java:1634)
      at org.jboss.remoting.Client.invoke(Client.java:548)
      at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.remoting.IsLocalProxyFactoryInterceptor.invoke(IsLocalProxyFactoryInterceptor.java:70)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:61)
      ... 10 more
      Caused by: java.io.InvalidClassException: org.jboss.ejb3.remoting.BaseRemoteProxy; local class incompatible: stream classdesc serialVersionUID = 1126421850898582900, local class serialVersionUID = -2711693270411201590
      at java.io.ObjectStreamClass.initNonProxy(Unknown Source)
      at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
      at java.io.ObjectInputStream.readClassDesc(Unknown Source)
      at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
      at java.io.ObjectInputStream.readClassDesc(Unknown Source)
      at java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
      at java.io.ObjectInputStream.readClassDesc(Unknown Source)
      at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
      at java.io.ObjectInputStream.readObject0(Unknown Source)
      at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
      at java.io.ObjectInputStream.readSerialData(Unknown Source)
      at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
      at java.io.ObjectInputStream.readObject0(Unknown Source)
      at java.io.ObjectInputStream.readObject(Unknown Source)
      at org.jboss.aop.joinpoint.InvocationResponse.readExternal(InvocationResponse.java:122)
      at java.io.ObjectInputStream.readExternalData(Unknown Source)
      at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
      at java.io.ObjectInputStream.readObject0(Unknown Source)
      at java.io.ObjectInputStream.defaultReadFields(Unknown Source)
      at java.io.ObjectInputStream.readSerialData(Unknown Source)
      at java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
      at java.io.ObjectInputStream.readObject0(Unknown Source)
      at java.io.ObjectInputStream.readObject(Unknown Source)
      at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObjectVersion2_2(JavaSerializationManager.java:239)
      at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:133)
      at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:120)
      at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.versionedRead(MicroSocketClientInvoker.java:957)
      at org.jboss.remoting.transport.socket.MicroSocketClientInvoker.transport(MicroSocketClientInvoker.java:586)
      at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
      at org.jboss.remoting.Client.invoke(Client.java:1634)
      at org.jboss.remoting.Client.invoke(Client.java:548)
      at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:62)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.ejb3.remoting.IsLocalProxyFactoryInterceptor.invoke(IsLocalProxyFactoryInterceptor.java:70)
      at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      at org.jboss.aspects.remoting.PojiProxy.invoke(PojiProxy.java:61)
      at $Proxy0.createProxy(Unknown Source)
      at org.jboss.ejb3.JndiProxyFactory.getObjectInstance(JndiProxyFactory.java:53)
      at javax.naming.spi.NamingManager.getObjectInstance(Unknown Source)
      at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1127)
      at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1144)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:707)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:589)
      at javax.naming.InitialContext.lookup(Unknown Source)
      at fr.horoquartz.client.Client.getRemoteRequest(Client.java:27)
      at fr.horoquartz.client.Client.main(Client.java:42)
      at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:74)
      ... 14 more

      When i load the EJB3 on the server embedded in the JBoss Developer Studio my client start with succes.
      When i load the EJB3 on anoter machine i have the exception.

      Thanks in advance for any reponses.