3 Replies Latest reply on Mar 9, 2005 2:11 PM by holgercasties

    incompatible stream classdesc serialVersionUID

    holgercasties

      Hi.

      I posted the following to the EJB3 user list, at first:

      I'm using EJB-3.0_Previous_3, JBoss-4.0.1sp1, JBossIDE-1.5-Preview-jre1.5-ALL and Eclipse 3.1M5a under Win2000, WinXP and LINUX.
      (I followed the install instructions.)

      When I am trying to run the 'stateless' example of the EJB3 tutorial the following exceptions occur when running the 'client' (client.java):

      Exception in thread "main" javax.naming.CommunicationException [Root exception is java.io.InvalidClassException: org.jboss.ejb3.remoting.BaseRemoteProxy; local class incompatible: stream classdesc serialVersionUID = -1019635950408433617, local class serialVersionUID = -2289426881135628080]
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:663)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:520)
      at javax.naming.InitialContext.lookup(InitialContext.java:351)
      at org.jboss.tutorial.stateless.client.Client.main(Client.java:19)
      Caused by: java.io.InvalidClassException: org.jboss.ejb3.remoting.BaseRemoteProxy; local class incompatible: stream classdesc serialVersionUID = -1019635950408433617, local class serialVersionUID = -2289426881135628080
      at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:519)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1546)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1460)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1693)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
      at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1912)
      at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1836)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1713)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:339)
      at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
      at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:51)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:566)
      ... 3 more


      The answer of Bill Burke was:
      "JBoss IDE has old version of EJB3 within it. Not sure how to fix. You'll need to post on the JBoss IDE user list."

      (PS: EJB-3.0_Previous_4 has been released on Friday.)

        • 1. Re: incompatible stream classdesc serialVersionUID
          lowhm

          Hi,

          This is likely due to the problem that the version of class on your client is different from server.

          E.g.
          You call the EJB from a servlet, thus servlet is client.
          On your servlet, you will have some class of your EJB.
          If you make some changes to your EJB and redeploy your EJB, but didn't update your WAR app, your servlet will connect to the EJB expecting the old version of the class, and thus cause the Exception.
          You may wish to try to update both the EJB and WAR.

          Note that this is also common if you are using Hibernate.
          i.e. even though you have change some class in the mapping classes and you EJB using it has been updated, you still need to update the hibernate.sar for example.

          Hope this helps.

          Cheers.


          Han Ming

          • 2. Re: incompatible stream classdesc serialVersionUID
            alexsmr

             


            You call the EJB from a servlet, thus servlet is client.
            On your servlet, you will have some class of your EJB.
            If you make some changes to your EJB and redeploy your EJB, but didn't update your WAR app, your servlet will connect to the EJB expecting the old version of the class, and thus cause the Exception.
            You may wish to try to update both the EJB and WAR.


            While dealing with entrprise application this is quite correct: the fact is that this is prescribed by specifications. However with Eclipse plugin it is look like design problem.

            The versions of jar files supported by plugin can be different from server side counterparts, due to the natural software developemnt cycle. This introduce a problem of synchronizing the plugin's jars with each new versions of the server.

            Very elegant and, from my point of view, correct approach have Eclipse WTP project: you shift the responsibility to the user. In order to run/develop against some server user must define the server "runtime", that in turn contributes required jars directly from the server.

            BTW: do you plan to support WTP?

            Alex.

            • 3. Re: incompatible stream classdesc serialVersionUID
              holgercasties

              Thanks a lot for your answers, Han Ming and Alex.

              I did what you wrote, Alex. I defined the server "runtime" in my Eclipse project:
              I created a plain Java Project and added two user libraries (EJB3 Library and JBoss Client). 'EJB3 Library' contains the needed jar-files of Hibernate3 (from EJB-3.0_Previous_4/lib). These are exactly the jar-files which I had copied to JBoss-4.0.1sp1 (following the install instructions of EJB-3.0_Previous_4).
              'JBoss Client' contains the needed jar-files of JBoss-4.0.1sp1/client.

              Now, the stateless example of EJB-3.0_Previous_4 is running from inside the Eclipse IDE.

              Holger