Skip to main content

JNDI URL for connecting remotely

1 reply [Last post]
cmathrusse
Offline
Joined: 2008-04-15
Points: 0

We are using Axway Synchrony EndPoint Activator as our trading partner engine. We want to connect to a JMS queue defined in the GlassFish cluster. The ConnectionFactory is defined as well as the Queues we want to use. Connecting seems rather easy and I've even written a client capable of connecting to GlassFish, based upon the examples online.

The issue I have is that while I have copied the libraries and configured Axway to use them I am having difficulty getting the connection to work based upon the configuration that Axway offers.Basically the interface provides me with a way of specifying the JNDI URL and the JNDI Initial Context Factory.

I've specified the following but with no luck:
JNDI URL = iiop://OURSERVER:1700
Initial Context Factory = com.sun.enterprise.naming.SerialInitContextFactory

Are these values correct? Should this be enough to connect to GlassFish?

I've also tried the following but it resulted in a timeout.
props.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"com.sun.appserv.naming.S1ASCtxFactory");
props.put(javax.naming.Context.PROVIDER_URL, "iiop://OURSERVER:1700");

Any help is appreciated.
Thanks...

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
cmathrusse
Offline
Joined: 2008-04-15
Points: 0

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?