WildFly Remote Programmatic JNDI Access

From NovaOrdis Knowledge Base
Revision as of 08:43, 8 September 2017 by Ovidiu (talk | contribs) (→‎Overview)
Jump to navigation Jump to search

Internal

Relevance

  • EAP 6
  • EAP 7

Overview

This article describes remote programmatic JNDI access for WildFly/EAP. The article was written using an EAP 7.0.4 instance.

EAP 7

Classpath

The client's classpath must include $JBOSS_HOME/bin/client/jboss-client.jar.

API


Properties properties = new Properties();

properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
properties.put(Context.PROVIDER_URL, "http-remoting://localhost:8080");

Context c = new InitialContext(properties);

Queue myTestQueue = (Queue)c.lookup("jms/queue/myTestQueue");

Remoting

The remoting subsystem URL to access the JNDI service is "http-remoting://<host>:8080". For more details, see:

The Remoting Subsystem

Code

https://github.com/NovaOrdis/playground/tree/master/jboss/jndi/simplest-eap7