How do I access EJBs remotely
JNDI Properties
Using a Provider URL
You'll need a jndi.properties on the remote client which looks like this:
#jboss JNDI properties java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.provider.url=jnp://localhost:1099 java.naming.factory.url.pkgs=org.jnp.interfaces ### The TimedSocketFactory connection timeout in milliseconds (0 == blocking) jnp.timeout=0 ### The TimedSocketFactory read timeout in milliseconds (0 == blocking) jnp.sotimeout=0
Replace localhost with the jboss's DNS name or IP and if you have configured the jboss naming service for some other port, you will need to change the 1099 to reflect that port. You can also provide a delimited list for the provider URL like java.naming.provider.url=jnp://192.168.99.1:1100,192.168.99.2:1100,192.168.99.3:1100
The last two timeout properties are optional, defaults are zero.
Using Naming Discovery
If you would like to use Naming Discovery (appropriate for a clustered environment), you will need a jndi.properties on the remote client which looks like this:
#jboss JNDI properties java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.provider.url= java.naming.factory.url.pkgs=org.jnp.interfaces jnp.partitionName=YourPartitionName
This configuration presupposes that your network is set up in such a way that multicast traffic is visible between your remote client and the EJB-serving JBoss instance. (e.g. the machines are on the same subnet) It also assumes that you have configured your serving JBoss instance to be a member of the
YourPartitionName
partition.
Interfaces
You must use Remote and RemoteHome interfaces.
Security
If you have configured a secure realm, you will need to set up a JAAS security login to the EJB tier.
Comments