5 Replies Latest reply on Nov 10, 2008 1:18 PM by Peter Johnson

    Lookup error [Jboss 3.2.5 >> 4.2.2]

    Anderson Rodrigues Araújo Newbie

      Hi,

      I have an application A, which runs on Jboss 3.2.5 (JDK 1.4) and I'm trying to lookup an EJB (2.1) on another application B, which runs on Jboss 4.2.2.GA (JDK 1.6), but I'm getting the following error:

      2008-10-13 21:40:45,023 INFO [STDOUT] javax.naming.CommunicationException [Root exception is java.io.InvalidClassException: org.jboss.util.id.GUID; local class incompatible: stream classdesc serialVersionUID = 3289509836244263718, local class serialVersionUID = 6926421946503004889]
      2008-10-13 21:40:45,032 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:649)
      2008-10-13 21:40:45,036 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:509)
      2008-10-13 21:40:45,041 INFO [STDOUT] at javax.naming.InitialContext.lookup(InitialContext.java:347)
      


      I understand Jboss 3.2.5 has a different version of GUID class than Jboss 4.2.2, but I really need to make this lookup. Does anyone have an idea?

      Above the code I'm using to make the lookup:

      Properties props = new Properties();
      props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      props.put(Context.PROVIDER_URL, "192.168.0.100:1099");
      props.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
      
      InitialContext ic = new InitialContext(props);
      Object objref = ic.lookup("MyEJB");
      VendasFuncoesHome home = (MyEJBHome) PortableRemoteObject.narrow(objref, MyEJBHome.class);
      


      Tks

        • 2. Re: Lookup error [Jboss 3.2.5 >> 4.2.2]
          Peter Johnson Master

          The high-level answer is that your client and the server need to be using the same versions of the classes that are being serialized and transferred. To do this, you need to package the jboss422/lib/jboss-common.jar into your application. You will have to set up a loader repository so that you app will use this jar file instead of the one that comes with jboss325.

          That is the general idea. Whether it will work in practice, I don't know because I have not tried it. Also, not having tried it, I could not provide any details on getting it to work.

          Loader repository (class scoping) ref: http://www.jboss.org/community/docs/DOC-9288

          • 3. Re: Lookup error [Jboss 3.2.5 >> 4.2.2]
            Anderson Rodrigues Araújo Newbie

            Hi Peter,

            Thanks for the suggestion. I'll try this approach and I let you know.

            • 4. Re: Lookup error [Jboss 3.2.5 >> 4.2.2]
              Anderson Rodrigues Araújo Newbie

               

              "PeterJ" wrote:
              The high-level answer is that your client and the server need to be using the same versions of the classes that are being serialized and transferred. To do this, you need to package the jboss422/lib/jboss-common.jar into your application. You will have to set up a loader repository so that you app will use this jar file instead of the one that comes with jboss325.


              Hi,

              I have tried to package jboss-common.jar in my application A and configured classloader parameters, but now I'm getting another error, probably because Jboss 4.2.2' classes are compiled on Java 1.5 and Jboss 3.2.5 runs on Java 1.4.

              2008-11-09 19:19:38,366 INFO [STDOUT] java.lang.UnsupportedClassVersionError: org/jnp/interfaces/Naming (Unsupported major.minor version 49.0)
              2008-11-09 19:19:38,366 INFO [STDOUT] at java.lang.ClassLoader.defineClass0(Native Method)
              2008-11-09 19:19:38,366 INFO [STDOUT] at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
              2008-11-09 19:19:38,366 INFO [STDOUT] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
              2008-11-09 19:19:38,366 INFO [STDOUT] at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
              2008-11-09 19:19:38,366 INFO [STDOUT] at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
              2008-11-09 19:19:38,366 INFO [STDOUT] at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
              2008-11-09 19:19:38,366 INFO [STDOUT] at java.security.AccessController.doPrivileged(Native Method)
              2008-11-09 19:19:38,366 INFO [STDOUT] at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
              2008-11-09 19:19:38,366 INFO [STDOUT] at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
              2008-11-09 19:19:38,366 INFO [STDOUT] at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
              2008-11-09 19:19:38,366 INFO [STDOUT] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
              2008-11-09 19:19:38,366 INFO [STDOUT] at java.lang.ClassLoader.defineClass0(Native Method)
              2008-11-09 19:19:38,366 INFO [STDOUT] at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
              2008-11-09 19:19:38,366 INFO [STDOUT] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
              2008-11-09 19:19:38,366 INFO [STDOUT] at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
              2008-11-09 19:19:38,366 INFO [STDOUT] at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
              


              Any clue?

              Tks

              • 5. Re: Lookup error [Jboss 3.2.5 >> 4.2.2]
                Peter Johnson Master

                You have one of two choices:

                a) One is to recompile the files on jboss-common.jar with the 1.4 compiler. You probably do not need all of the classes, just the ones you need to make the EJB calls.

                b) Run 3.2.5 with JDK 1.5

                I would try option b first, and if that does not work, then option a.