To connect to an OpenJMS server running on the local host, using
the default RMI configuration, construct an
InitialContext
as follows:
Hashtable properties = new Hashtable(); properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.exolab.jms.jndi.InitialContextFactory"); properties.put(Context.PROVIDER_URL, "rmi://localhost:1099/"); Context context = new InitialContext(properties);
The JNDI Context.PROVIDER_URL
property above, has
the format:
"rmi://<registry-host>:<registry-port>/"
Where:
By default, the OpenJMS server is configured to use an embedded RMI registry. Under this configuration, registry-host will be the host that the OpenJMS server is running on.
To administer an OpenJMS server running on the local host, using
the default RMI configuration, construct a
JmsAdminServerIfc
as follows:
String url = "rmi://localhost:1099/"; JmsAdminServerIfc admin = AdminConnectionFactory.create(url);
The URL argument has the same format as the
Context.PROVIDER_URL
described in
Using the RMI connector