Este contenido no está disponible en el idioma seleccionado.

Chapter 5. Remote JNDI lookup


5.1. Registering objects to JNDI

The Java Naming and Directory Interface (JNDI) is a Java API for a directory service that allows Java software clients to discover and look up objects via a name.

If an object, registered to JNDI, is supposed to be looked up by remote JNDI clients (i.e. a client that runs in a separate JVM), then it must be registered under java:jboss/exported context.

For example, if the JMS queue in a messaging-activemq subsystem must be exposed for remote JNDI clients, then it must be registred to JNDI, like java:jboss/exported/jms/queue/myTestQueue. Remote JNDI client can look it up by name jms/queue/myTestQueue.

Example: Configuration of the Queue in standalone-full(-ha).xml

<subsystem xmlns="urn:jboss:domain:messaging-activemq:1.0">
  <server name="default">
    ...
    <jms-queue name="myTestQueue" entries="java:jboss/exported/jms/queue/myTestQueue"/>
    ...
  </server>
</subsystem>
Copy to Clipboard Toggle word wrap

5.2. Configuring remote JNDI

A remote JNDI client can connect and lookup objects by name from JNDI. It must have jboss-client.jar on its class path. The jboss-client.jar is available at EAP_HOME/bin/client/jboss-client.jar.

The following example shows how to lookup the myTestQueue queue from JNDI in remote JNDI client:

Example: Configuration for an MDB Resource Adapter

Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
properties.put(Context.PROVIDER_URL, "http-remoting://<hostname>:8080");
context = new InitialContext(properties);
Queue myTestQueue = (Queue) context.lookup("jms/queue/myTestQueue");
Copy to Clipboard Toggle word wrap

Volver arriba
Red Hat logoGithubredditYoutubeTwitter

Aprender

Pruebe, compre y venda

Comunidades

Acerca de la documentación de Red Hat

Ayudamos a los usuarios de Red Hat a innovar y alcanzar sus objetivos con nuestros productos y servicios con contenido en el que pueden confiar. Explore nuestras recientes actualizaciones.

Hacer que el código abierto sea más inclusivo

Red Hat se compromete a reemplazar el lenguaje problemático en nuestro código, documentación y propiedades web. Para más detalles, consulte el Blog de Red Hat.

Acerca de Red Hat

Ofrecemos soluciones reforzadas que facilitan a las empresas trabajar en plataformas y entornos, desde el centro de datos central hasta el perímetro de la red.

Theme

© 2026 Red Hat