users@glassfish.java.net

Re: JNDI URL for connecting remotely

From: <glassfish_at_javadesktop.org>
Date: Fri, 15 Aug 2008 15:32:09 PDT

OK, I finally got this to work. (not that it was obvious)

First, appserv-rt.jar contains the file jndi.properties. This is for passing specific JNDI bootstrapping properties to[i] InitialContext(args)[/i]. This is so you don't have to specify a Properties object with all the configuration information, meaning you can simply call [i]new InitialContext() [/i]without arguments. The problem is that this defaults to localhost. If you want to specify a different server or port you must specify these value as arguments to the JVM.

java -Dorg.omg.CORBA.ORBInitialHost=com.acme.Host1
java -Dorg.omg.CORBA.ORBInitialPort=2735

While this might seem easy it is not intuitive. Especially if you have existing clients that are expecting to initialize the context using the following method:

props.setProperty("java.naming.factory.initial", "com.sun.enterprise.naming.SerialInitContextFactory");
props.put("java.naming.provider.url","iiop://com.acme.Host1:2735");

If you specify the provider.url it appears that it is simply ignored. To get this to work correctly I had to pass in the arguments to the JVM as listed above. Then I specified that parameters in the properties file, as listed above also. The parameters passed into [i]new InitialContext(props)[/i] are simply ignored. It is the values passed in on the command line that are used to make the connection.

So why didn't Sun honor the old way of doing things like every other app server?
[Message sent by forum member 'cmathrusse' (cmathrusse)]

http://forums.java.net/jive/thread.jspa?messageID=293656