Accessing Beans (EJB)
by, 11-26-2011 at 07:36 PM (1623 Views)
In the post, I will write about how to accessing a bean in EJB.
Accessing deployed beans is simple. First write the the client code and set up JNDI environment settings for the client. It can be done via a JNDI properties file. Now you have to set the class path for the client and add the following file locations to it:
jboss-client.jar, jnp-client.jar, EJB interfaces, and the directory where the JNDI properties file is stored
Remember, two JNDI settings must be made which are:
- the initial context factory
- the provider URL
These properties are best established in a JNDI properties file.
After setting jndi.properties file, place it in a directory and place that directory into the client's classpath.
Now simply drop the JAR into the deploy directory, start the client, and invoke the EJB service.