JNDI noInitialContext Error

I am building a simple JMS client but can not get it to run on remote machines

because it cannot find the JNDI provider. ("Jndi lookup fails")

Using Netbeans 5.5, Sun Application Server (9) on XP.

What do I need to install on the client machines to get the JNDI lookup and JMS clients to work? They already have the JRE 1.5.0_08.

I have already tried setting the environment:

String hostserver ="ServerNameHere";

Hashtable env =new Hashtable();

env.put("java.naming.factory.initial","com.sun.jndi.cosnaming.CNCtxFactory");

env.put("java.naming.provider.url","iiop://" + hostserver +":"+3700);

but that does not seem to do anything.

I have read about JNDI.properties file but I do not have one nor do I know where to put it. note: there is not one in my j2ee.jar(this file is empty) or my javaee.jar files.

Thanks

[1071 byte] By [jaymorrisa] at [2007-10-3 4:28:26]
# 1

The preferred way of looking up for remote objects is to use the no-argument InitialContext() constructor. For that you need to include the appserver-rt.jar [for the Corba classes, if I remember correctly] and add the following properties

org.omg.CORBA.ORBInitialHost = <your server host name>

org.omg.CORBA.ORBInitialPort = <port for the JNDI service>

You can set these properties for the client, either by setting the System properties through the code or using the -D option from command line.

If you are explicitly pointing to Cos Naming service, follow the steps in the link.

http://docs.sun.com/app/docs/doc/819-3659/6n5s6m5c2?a=view#beanu

Your provider URL needs to look like:

corbaname:iiop:host:port#a/b/name

aniseeda at 2007-7-14 22:31:24 > top of Java-index,Java Essentials,Java Programming...