Red Hat Training

A Red Hat training course is available for Red Hat JBoss Enterprise Application Platform

7.2. Configuring a Remote JNDI Client

Remote JNDI clients can look up and connect to objects by name using JNDI. The client must have jboss-client.jar on its class path.
The following example shows how to look up the myTestQueue JMS queue from a remote JNDI client:

Example 7.2. Example Remote JNDI Lookup

Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
properties.put(Context.PROVIDER_URL, "remote://<hostname>:4447");
context = new InitialContext(properties);
Queue myTestQueue = (Queue) context.lookup("jms/queue/myTestQueue");