WildFly Remote Programmatic JNDI Access: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(11 intermediate revisions by the same user not shown)
Line 5: Line 5:
=Relevance=
=Relevance=


EAP 7
* EAP 6
* EAP 7


=Overview=
=Overview=
Line 11: Line 12:
This article describes remote programmatic JNDI access for WildFly/EAP. The article was written using an EAP 7.0.4 instance.
This article describes remote programmatic JNDI access for WildFly/EAP. The article was written using an EAP 7.0.4 instance.


=Classpath=
=EAP 7=
 
==EAP7 Remote Programmatic JNDI Access Classpath==


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


=API=
==EAP7 Remote Programmatic JNDI Access API==
 
<syntaxhighlight lang='java'>
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");
</syntaxhighlight>


<pre>
==EAP7 Remoting==


Properties properties = new Properties();
The remoting subsystem URL to access the JNDI service is "http-remoting://<host>:8080". For more details, see:
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");


</pre>
{{Internal|Remoting_WildFly_Subsystem|The Remoting Subsystem}}


=Code=
==EAP7 Code==


{{External|https://github.com/NovaOrdis/playground/tree/master/jboss/jndi/simplest-eap7}}
{{External|https://github.com/NovaOrdis/playground/tree/master/jboss/jndi/simplest-eap7}}
=EAP 6=
==EAP6 Remote Programmatic JNDI Access Classpath==
The client's classpath must include <tt>$JBOSS_HOME/bin/client/jboss-client.jar</tt>.
==EAP6 Remote Programmatic JNDI Access API==
<syntaxhighlight lang='java'>
Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
properties.put(Context.PROVIDER_URL, "remote://localhost:4447");
Context c = new InitialContext(properties);
Queue myTestQueue = (Queue)c.lookup("jms/queue/myTestQueue");
</syntaxhighlight>
==EAP6 Remoting==
The remoting subsystem URL to access the JNDI service is "remote://<host>:4447". For more details, see:
{{Internal|Remoting_WildFly_Subsystem|The Remoting Subsystem}}
==EAP6 Code==
{{External|https://github.com/NovaOrdis/playground/tree/master/jboss/jndi/simplest-eap6}}

Latest revision as of 08:48, 8 September 2017

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

EAP7 Remote Programmatic JNDI Access Classpath

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

EAP7 Remote Programmatic JNDI Access 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");

EAP7 Remoting

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

The Remoting Subsystem

EAP7 Code

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

EAP 6

EAP6 Remote Programmatic JNDI Access Classpath

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

EAP6 Remote Programmatic JNDI Access API

Properties properties = new Properties();

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

Context c = new InitialContext(properties);

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

EAP6 Remoting

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

The Remoting Subsystem

EAP6 Code

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