Look Up Objects Using Full URL Names

Java clients can look up administered objects using full URL names. In this case, the Context.URL_PKG_PREFIXES property is used in place of the Context.PROVIDER_URL property.

For example:

Hashtable env = new Hashtable();
  env.put(Context.URL_PKG_PREFIXES,"com.tibco.tibjms.naming");
  env.put(Context.PROVIDER_URL,"tibjmsnaming://localhost:7222");
  env.put(Context.SECURITY_PRINCIPAL,"userName");
  env.put(Context.SECURITY_CREDENTIALS,"password");
jndiContext = new InitialContext(env);

When using full URL names, you can look up objects like the following example:

Topic sampleTopic = (javax.jms.Topic)jndiContext.lookup(
      "tibjmsnaming://jmshost:7222/topic.sample");
Queue sampleQueue = (javax.jms.Queue)jndiContext.lookup(
      "tibjmsnaming://jmshost:7222/queue.sample");

For further information on how to use full URL names, refer to the tibjmsJNDIRead.java example located in the EMS_HOME/samples/java/JNDI directory.