4 Replies Latest reply on Oct 3, 2002 6:52 PM by Arvind

    JNDI Lookup problem.

    Arvind Newbie

      I am trying to get reference to the EJB context to do a JNDI lookup, but I am getting the folowing stack trace

      javax.naming.CommunicationException. Root exception is java.io.InvalidClassExce
      ption: org.jboss.proxy.ProxyProxy; Local class not compatible: stream classdesc
      serialVersionUID=-7645399386108564840 local class serialVersionUID=4601883390390
      399130
      at java.io.ObjectStreamClass.validateLocalClass(ObjectStreamClass.java:5
      23)
      at java.io.ObjectStreamClass.setClass(ObjectStreamClass.java:567)
      at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java
      :936)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
      at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
      at java.rmi.MarshalledObject.get(MarshalledObject.java:138)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:439)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:419)
      at javax.naming.InitialContext.lookup(InitialContext.java:350)
      at OmniConnectCalcClientJboss.main(OmniConnectCalcClientJboss.java:21)

      My context is configured as in following code

      public static Context getInitialContext()
      throws NamingException
      {
      Properties p = new Properties();
      p.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
      p.setProperty(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
      p.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
      return new InitialContext(p);
      }

      And also I am setting a ll the required jar files in the client classpath.

      Any information is greatly appreciated.

      Thanks,

      Arvind

        • 1. Re: JNDI Lookup problem.
          Dan Dobrin Newbie

          Why don't you try the following for the context:

          p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");

          p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");

          p.put(Context.PROVIDER_URL, "localhost:1099");

          Dan

          • 2. Re: JNDI Lookup problem.
            Arvind Newbie

            Dan,
            Thanks for your reply.I tried changing the context as follows
            public static Context getInitialContext()
            throws NamingException
            {
            Properties p = new Properties();
            p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
            p.put(Context.URL_PKG_PREFIXES, "jboss.naming:org.jnp.interfaces");
            p.put(Context.PROVIDER_URL, "localhost:1099");
            return new InitialContext(p);
            }

            I get the same error

            javax.naming.CommunicationException. Root exception is java.io.InvalidClassExce
            ption: org.jboss.proxy.ProxyProxy; Local class not compatible: stream classdesc
            serialVersionUID=-7645399386108564840 local class serialVersionUID=4601883390390
            399130
            at java.io.ObjectStreamClass.validateLocalClass(ObjectStreamClass.java:5
            23)
            at java.io.ObjectStreamClass.setClass(ObjectStreamClass.java:567)
            at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java
            :936)
            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
            at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
            at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
            at java.rmi.MarshalledObject.get(MarshalledObject.java:138)
            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:439)
            at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:419)
            at javax.naming.InitialContext.lookup(InitialContext.java:350)
            at OmniConnectCalcClientJboss.main(OmniConnectCalcClientJboss.java:21)



            • 3. Re: JNDI Lookup problem.
              Jesper Knudsen Newbie

              The serialVersionUID mismatch is caused by using two different jboss-???.jar file at the application server side and another at the client side. Typically from two different versions of JBoss.

              Make sure that you are using exactly the same jboss????.jar file at the client side that are stored at the jboss/client folder.

              /Jesper

              • 4. Re: JNDI Lookup problem.
                Arvind Newbie

                Hi Jasper,
                I verified your suggestion.I am using Jboss-2.4.6-Tomcat-4.0.3 .Following is the command line execution of my client where in I am setting required jars in classpath

                C:\Java\JBOSS_DEV_HOME\OmniConnectCalc>set classpath=.;C:\jdk1.3.1_02\lib;C:\Jav
                a\JBOSS_DEV_HOME\OmniConnectCalc\build;C:\Java\JBoss-2.4.6_Tomcat-4.0.3\jboss\cl
                ient\jnp-client.jar;C:\Java\JBoss-2.4.6_Tomcat-4.0.3\jboss\client\jass.jar;C:\Ja
                va\JBoss-2.4.6_Tomcat-4.0.3\jboss\client\jboss-client.jar;C:\Java\JBoss-2.4.6_To
                mcat-4.0.3\jboss\client\jbosssx-client.jar;C:\classes\FrameWork.jar;C:\bea\wlser
                ver6.1\lib\weblogic.jar

                C:\Java\JBOSS_DEV_HOME\OmniConnectCalc>set path=.;C:\jdk1.3.1_02\bin

                C:\Java\JBOSS_DEV_HOME\OmniConnectCalc>java OmniConnectCalcClientJboss
                Got context : javax.naming.InitialContext@13dee9
                javax.naming.CommunicationException. Root exception is java.io.InvalidClassExce
                ption: org.jboss.proxy.ProxyProxy; Local class not compatible: stream classdesc
                serialVersionUID=-7645399386108564840 local class serialVersionUID=4601883390390
                399130
                at java.io.ObjectStreamClass.validateLocalClass(ObjectStreamClass.java:5
                23)
                at java.io.ObjectStreamClass.setClass(ObjectStreamClass.java:567)
                at java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java
                :936)
                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
                at java.io.ObjectInputStream.inputObject(ObjectInputStream.java:1186)
                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:386)
                at java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
                at java.rmi.MarshalledObject.get(MarshalledObject.java:138)
                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:439)
                at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:419)
                at javax.naming.InitialContext.lookup(InitialContext.java:350)
                at OmniConnectCalcClientJboss.main(OmniConnectCalcClientJboss.java:21)


                .I doubly ensured that I am using the same jars on both the sides.I had read in one of the posts that Jboss uses a different class loader than the the client,so this may creating the difference in the serailization ID ,hence causing the InvalidClassException.This sounds interesting ...Has anybody come across a situation like this and have any solutions?

                Thanks,

                Arvind