3 Replies Latest reply on Mar 29, 2006 9:53 AM by sappenin

    Inconsistent jbossall-client.jar and jboss-j2ee.jar classes

    sappenin

      Not sure if this is the right place to post this -- it's related to ejb3...from what I can tell (on JBoss 4.0.4RC1), the javax.ejb classes inside of jbossall-client.jar and jboss-j2ee.jar are inconsistent, as they are causing a java.io.InvalidClassException for me.

      Here's the background of the error I'm seeing. Skip to the last paragraph of this post for the bottom line.

      So, I'm trying to replicate the SRP (Secure Remote Password) example here (http://docs.jboss.org/jbossas/jboss4guide/r1/html/ch8.chapter.html#ch8.srp.sect), except using EJB3. I'm running JBoss 4.0.4RC1 with EJB3 RC5.

      This example creates a simple EJB and allows an RMI client to authenticate using SRP. The client accesing the EJB is simply a stand-alone java app.

      Almost everything works -- I can connect to the remote server, lookup the Bean I'm trying to get (EchoBean), and cast the Object to the appropriate remote interface. However, if I try to call function on the ejb remote proxy, I get a marshalling exception. My code, and the exception are below.

      Example Code:

      System.out.println("Logging in using the 'srp' configuration");
       String username = args[0];
       char[] password = args[1].toCharArray();
       UsernamePasswordHandler handler = new UsernamePasswordHandler(username, password);
       lc = new LoginContext("srp", handler);
       lc.login();
       InitialContext iniCtx = new InitialContext();
       Object ref = iniCtx.lookup("EchoBean/remote");
       EchoRemote echo = (EchoRemote) ref; //exception thrown here.
       System.out.println("Created Echo");
       System.out.println("Echo.echo()#1 = "+echo.echo("This is call 1"));
       Thread.currentThread().sleep(15*1000);



      The Exception:
      [ERROR,SocketClientInvoker] Got marshalling exception, exiting
      java.io.InvalidClassException: javax.ejb.EJBException; local class incompatible: stream classdesc serialVersionUID = 2512003687642492863, local class serialVersionUID = 796770993296843510
       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.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.receiveObject(JavaSerializationManager.java:128)
       at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:66)
       at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:265)
       at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:136)
       at org.jboss.remoting.Client.invoke(Client.java:444)
       at org.jboss.remoting.Client.invoke(Client.java:407)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:55)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:65)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:98)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
       at $Proxy2.echo(Unknown Source)
      


      So, this indicates that the client I'm using has a different version of javax.ejb.EJBException than the server does. Through a bunch of digging, I was able to figure out that my client is using the javax.ejb.EJBException from the jar file located in "JBOSS_HOME/client/jbossall-client.jar" - a seemingly appropriate jar to be using on the client. The date/time stamp of the javax.ejb.EJBException in this jar is 02/07/2006 3:22 pm. However, from what I can tell, the JBoss server is using the javax.ejb.EJBException out of the jar "JBOSS_HOME/server/[serverinstance]/lib/jboss-j2ee.jar, which has a date/time stamp of 02/02/2006 9:23 am.

      So, I am able to work around this issue by changing my client's classpath to include the jboss-j2ee.jar file first.

      All this begs the question -- are the client jars and the server jars in the 4.0.4RC1 releease (at least for the javax.ejb package) supposed to be different, with different Serail UID/date/times? It seems like the client and the server should be in sync.

      Thanks!

      David

        • 1. Re: Inconsistent jbossall-client.jar and jboss-j2ee.jar clas
          starksm64

          Not possible:

          public class EJBException extends RuntimeException
          {
           /** @since 4.0.2 */
           private static final long serialVersionUID = 796770993296843510L;
          


          [starksm@banshee9100 client]$ serialver -classpath client/jbossall-client.jar javax.ejb.EJBException
          javax.ejb.EJBException: static final long serialVersionUID = 796770993296843510L;
          [starksm@banshee9100 jboss-4.0.4RC1-all]$ serialver -classpath server/default/lib/jboss-j2ee.jar javax.ejb.EJBException
          javax.ejb.EJBException: static final long serialVersionUID = 796770993296843510L;
          


          You have some other source of javax.ejb.EJBException that is out of date.


          • 2. Re: Inconsistent jbossall-client.jar and jboss-j2ee.jar clas
            sappenin

            Crap...you're right. It turns out that the Jboss Mail Server classes made it into my 4.04RC1 directory. Sorry about that. I'll raise this issue over on the JBMS forum.

            Thanks!

            • 3. Re: Inconsistent jbossall-client.jar and jboss-j2ee.jar clas
              sappenin

              Nevermind...it's not a JBMS issue either. JBMS 1.0M4 installer includes JBoss 4.0.3. I just needed to pick the right client directories to use.