2 Replies Latest reply on Jan 8, 2007 6:58 PM by Wally Lee

    ex19_1 problem context lookup

    minka mink Newbie

      if i execute ant run.client i get the following error message when in the client.java file the line

      TravelAgentService service = (TravelAgentService) jndi.Context.lookup("comp/env/service/TravelAgentService");

      is executed:

      [java] javax.naming.NamingException: Cannot unmarshall service ref meta data, cause: java.io.InvalidClassException: javax.xml.namespace.QName; local class incompatible: stream classdesc serialVersionUID = 4418622981026545151, local class serialVersionUID = -9120448754896609940
      [java] at org.jboss.ws.jaxrpc.ServiceObjectFactory.getObjectInstance(ServiceObjectFactory.java:127)
      [java] at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
      [java] at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1125)
      [java] at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1142)
      [java] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:705)
      [java] at org.jboss.naming.client.java.javaURLContextFactory$EncContextProxy.invoke(javaURLContextFactory.java:135)
      [java] at $Proxy0.lookup(Unknown Source)
      [java] at javax.naming.InitialContext.lookup(InitialContext.java:351)
      [java] at com.titan.clients.Client.main(Client.java:14)

      BUILD SUCCESSFUL

      please help me. thanks.

        • 1. Re: ex19_1 problem context lookup
          Wally Lee Newbie

          Quick fix:
          Add the following code into your "Client.java" class "getInitialContext()" method

          public static Context getInitialContext()
          throws javax.naming.NamingException
          {
          Properties p = System.getProperties();
          p.put("com.sun.xml.namespace.QName.useCompatibleSerialVersionUID", "1.0");

          System.setProperties(system);

          return new javax.naming.InitialContext();
          }


          DO not forget to import:
          import java.util.Properties;

          Then, it should work.

          • 2. Re: ex19_1 problem context lookup
            Wally Lee Newbie

            Sorry for the typo. Here is the right one:

            public static Context getInitialContext()
            throws javax.naming.NamingException
            {
            Properties p = System.getProperties();
            p.put("com.sun.xml.namespace.QName.useCompatibleSerialVersionUID", "1.0");

            System.setProperties(p);

            return new javax.naming.InitialContext();
            }