I have a EJB class that is used for searching,
@Local(ILuceneEmployeeSearchManagerLocal.class)
@Remote(ILuceneEmployeeSearchManagerRemote.class)
public class LuceneEmployeeSearchManager implements ILuceneEmployeeSearchManagerLocal, ILuceneEmployeeSearchManagerRemote{
....
}
There is another class in a WAR project in the same EAR, which accesses this,
public class EmployeeAccessor {
private ILuceneEmployeeSearchManagerRemote searcher;
public EmployeeMstAccessor() {
Context ic = null;
try {
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "<WHAT_TO_PUT_HERE>");
props.put(Context.PROVIDER_URL, "iiop://127.0.0.1:9083");
ic = new InitialContext(props);
this.searcher = (ILuceneEmployeeSearchManagerRemote) ic
.lookup("<WHAT_TO_PUT_HERE?>");
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
....
}
This is working perfectly, when I was performing local lookups using JNDI. Due to some requirements, it is now necessary to deploy the EAR in multiple APs, (both in clustered and non-clustered environments). Also, the application server used will be same across APs, but not necessarily Websphere, i.e all of the APs may be using JBoss/Websphere/Weblogic.
My question is there an implementation independent way of looking up and invoking remote EJBs ? Something that will work for Websphere, Weblogic or JBoss environments (homogeneous environments).
My second question is assuming the AP servers are running Websphere (in clustered or non-clustered environment), say I want EmployeeAccessor in all of the AP servers to be using the LuceneEmployeeSearchManager EJB deployed in AP01 (ip:x.x.x.x, port:yy), how do I configure it ? Is it necessary to give the full JNDI name (including cell name and node name for websphere) ? What are the proper values for INITIAL_CONTEXT_FACTORY ? and what is the correct JNDI lookup syntax ?
Thank you for any help :)