WildFly Remote Programmatic JNDI Access: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
Line 19: Line 19:
<pre>
<pre>


Properties properties = new Properties();  
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");  
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
context = new InitialContext(properties);
properties.put(Context.PROVIDER_URL, "http-remoting://localhost:8080");
Queue myTestQueue = (Queue) context.lookup("jms/queue/myTestQueue");
 
Context c = new InitialContext(properties);
 
Queue myTestQueue = (Queue)c.lookup("jms/queue/myTestQueue");


</pre>
</pre>

Revision as of 20:00, 7 February 2017

Internal

Relevance

EAP 7

Overview

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

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");

Code

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