3 Replies Latest reply on Aug 24, 2007 10:43 PM by Michael Schwartz

    jboss-ejb3-all.jar StatelessRemoteProxy serialVersionUID out

    Michael Schwartz Newbie

      I'm running JBoss 4.05.GA and Seam 1.2.1.GA. I'm trying to use RMI to call one of my SLSB's. I'm using MyEclipse 6.0.0GA, which is Eclipse 3.3 (not sure if this matters). I get this stack trace:

      JNDI Name: VmManagerSessionBean/remote
      FAILED: testLookupAccount
      javax.naming.CommunicationException [Root exception is java.io.InvalidClassException: org.jboss.ejb3.stateless.StatelessRemoteProxy; local class incompatible: stream classdesc serialVersionUID = 2583299153931800023, local class serialVersionUID = -9097306519795868]
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:723)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:588)
       at javax.naming.InitialContext.lookup(InitialContext.java:392)
       at us.ziacom.voicemail.test.TestVmManagerSessionBean.testLookupAccount(TestVmManagerSessionBean.java:22)
      Caused by: java.io.InvalidClassException: org.jboss.ejb3.stateless.StatelessRemoteProxy; local class incompatible: stream classdesc serialVersionUID = 2583299153931800023, local class serialVersionUID = -9097306519795868
       at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:562)
       at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1583)
       at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1496)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1732)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
       at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1945)
       at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1869)
       at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1753)
       at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1329)
       at java.io.ObjectInputStream.readObject(ObjectInputStream.java:351)
       at java.rmi.MarshalledObject.get(MarshalledObject.java:142)
       at org.jnp.interfaces.MarshalledValuePair.get(MarshalledValuePair.java:72)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:653)
       ... 25 more
      ... Removed 22 stack frames
      

      I see this post on the EJB3 Jira that seems relevant:
      http://jira.jboss.com/jira/browse/EJBTHREE-402

      I think I have to get the StatelessRemoteProxy object in JBoss, and the one that is being used in Seam, to match. The problem is, I'm not sure exactly how to do this. I see SEAM is including a file jboss-ejb3-all.jar, but the JBoss App Server has several jars that have ejb3 in the name.

      Thanks in advance!

      - Mike


        • 1. Re: jboss-ejb3-all.jar StatelessRemoteProxy serialVersionUID
          Pete Muir Master

          You should replace jboss-ejb3-all.jar with the relevant jars from the AS. See this for some tips
          http://wiki.jboss.org/wiki/Wiki.jsp?page=SeamDependencies

          • 2. Re: jboss-ejb3-all.jar StatelessRemoteProxy serialVersionUID
            Michael Schwartz Newbie

            My impression is that jboss-ejb3-all.jar is included in the jboss-embeddbable, not the JBoss AS.

            When I take out the jboss-ejb2-all.jar, and replace with the ejb files I see on the AS (ejb3-persistence.jar, jboss-annotations-ejb3.jar, jboss-ejb3-client.jar, jboss-ejb3x.jar) I get an error:

            javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
             at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
             at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
             at javax.naming.InitialContext.init(InitialContext.java:223)
             at javax.naming.InitialContext.<init>(InitialContext.java:197)
             at us.ziacom.voicemail.test.TestVmManagerSessionBean.testLookupAccount(TestVmManagerSessionBean.java:20)
            Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory
             at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
             at java.security.AccessController.doPrivileged(Native Method)
             at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
             at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
             at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
             at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
             at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
             at java.lang.Class.forName0(Native Method)
             at java.lang.Class.forName(Class.java:247)
             at com.sun.naming.internal.VersionHelper12.loadClass(VersionHelper12.java:46)
             at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
             ... 26 more
            


            This is my program. Its pretty simple...
            import java.util.Properties;
            
            import javax.naming.Context;
            import javax.naming.InitialContext;
            import javax.naming.NamingException;
            import javax.rmi.PortableRemoteObject;
            
            import org.testng.annotations.Test;
            
            import us.ziacom.action.VmManagerSessionBean;
            import us.ziacom.action.interfaces.IVmManagerRemote;
            import us.ziacom.vm.model.Account;
            
            public class TestVmManagerSessionBean {
            
             @Test(groups = { "sessionBean" })
             public void testLookupAccount() throws NamingException {
             Context ctx = new InitialContext(getInitialContextProperties());
             System.out.println("JNDI Name: " + VmManagerSessionBean.RemoteJNDIName);
             Object ref = ctx.lookup("voicemail/" + VmManagerSessionBean.RemoteJNDIName);
             IVmManagerRemote vmMgrRemote = (IVmManagerRemote) PortableRemoteObject.narrow(ref, IVmManagerRemote.class);
             Account acct = vmMgrRemote.lookupAccount("6467230651");
             System.out.println(acct.getFullname());
             }
            
             private static Properties getInitialContextProperties(){
             Properties props = new Properties();
            // props.put(Context.SECURITY_PRINCIPAL, "user");
            // props.put(Context.SECURITY_CREDENTIALS, "password");
             props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
             props.put(Context.PROVIDER_URL, "jnp://localhost:1099");
             props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
             return props;
             }
            }
            

            Do I need to change org.jnp.interfaces.NamingContextFactory to org.jboss.naming.NamingContextFactory?

            I am new to RMI... maybe that's why I am so confused...

            thanks in advance,

            - Mike

            • 3. Re: jboss-ejb3-all.jar StatelessRemoteProxy serialVersionUID
              Michael Schwartz Newbie

              ok... figured this one out.

              The jars that I needed were all in jboss-4.0.5.GA\client:


              * jbossall-client.jar
              * ejb3-persistence.jar
              * jbossall-client.jar
              * jboss-annotations-ejb3.jar
              * jboss-aspect-jdk50-client.jar
              * jboss-ejb3-client.jar
              * jboss-ejb3x.jar



              I also wrote a handy dandy python program to recursively search for classes in jar files. Make sure "jar" is in your path. Add #!... for unix.
              import os, sys
              from os.path import join
              
              dir = ""
              target = ""
              
              try:
               target = sys.argv[1]
               dir = sys.argv[2]
              except:
               target = raw_input("What is the target string: ")
               dir = raw_input("What is the root directory: ")
              
              
              l = os.walk(dir)
              
              for tup in l:
               dirName = tup[0]
               for fn in tup[2]:
               if fn[-3:] == "jar":
               fullPath = join(dirName, fn)
               f = os.popen("jar -tvf %s" % fullPath, "r")
               text = f.read()
               if text.find(target) > 1:
               print "FOUND IT: %s\n" % fn
               f = os.popen("jar -tvf %s" % fullPath, "r")
               lines = f.readlines()
               for line in lines:
               if line.find(target) > 1: print line