2 Replies Latest reply on Jan 27, 2003 6:17 AM by Pranav Kapil

    Problem with HELLO WORLD

    seemanto Newbie

      hi

      Can anyone tell me how to get a reference of the home object in a client running in a different jvm but same machine ?

      i have set the following properties in my client.

      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.provider.url=jnp://localhost:1099
      java.naming.factory.url.pkgs=org.jboss.naming

      And the i did the following. The idea was to get to the root context of the host and do further lookups.

      InitialContext ctx = new InitialContext();
      Context context;
      context = (Context)ctx.lookup("//localhost");

      But it is throwing exception in the line where i have done
      lookup("//localhost") Can anyone tell me what might be the problem ?

      The exception goes on like this:


      Exception in thread "main" java.lang.ExceptionInInitializerError
      at sun.rmi.runtime.Log$LoggerLogFactory.createLog(Log.java:155)
      at sun.rmi.runtime.Log.getLog(Log.java:121)
      at sun.rmi.server.LoaderHandler.(LoaderHandler.java:60)
      at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java:629)
      at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:257)
      at sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.jav
      a:200)
      at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:150
      3)
      at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1425)
      at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1
      616)
      at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1264)
      at java.io.ObjectInputStream.readObject(ObjectInputStream.java:322)
      at java.rmi.MarshalledObject.get(MarshalledObject.java:135)
      at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:112)
      at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:776)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:340)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:333)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at Client.main(Client.java:28)
      Caused by: java.lang.IllegalArgumentException: Null charset name
      at java.nio.charset.Charset.lookup(Charset.java:376)
      at java.nio.charset.Charset.isSupported(Charset.java:405)
      at sun.nio.cs.StreamEncoder.forOutputStreamWriter(StreamEncoder.java:67)

      at java.io.OutputStreamWriter.(OutputStreamWriter.java:93)
      at java.util.logging.StreamHandler.setOutputStream(StreamHandler.java:11
      6)
      at java.util.logging.StreamHandler.(StreamHandler.java:92)
      at sun.rmi.runtime.Log$InternalStreamHandler.(Log.java:261)
      at sun.rmi.runtime.Log$1.run(Log.java:169)
      at java.security.AccessController.doPrivileged(Native Method)
      at sun.rmi.runtime.Log$LoggerLog.(Log.java:165)


        • 1. Re: Problem with HELLO WORLD
          Mike Finn Apprentice

          The name server knows nothing about '//localhost'. If you want root context, use '/'.

          Look at the jndiview mbean to see the structure of the naming hierarchy.

          mike

          • 2. Re: Problem with HELLO WORLD
            Pranav Kapil Newbie

            Use following -- >
            If you have a jndi.propeties file having the peoperties listing
            -----------------------------------------------------------------
            InitialContext ctx = new InitialContext();
            Context context = (Context)ctx.lookup(System.getProperties());

            - OR -

            If you want to include it via command line or some other way
            -------------------------------------------------------------
            Context ctx = null;
            Properties props = new Properties();
            props.put("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
            props.put("java.naming.provider.url","jnp://localhost:1099");
            props.put ("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");

            ctx = new InitialContext (props);


            Cheers