I am working on setting up a servlet client which accesses Deployed EJBs. EJBs are deployed in 2 node setup on WebSphere 8.5
. On each server, I will be deploying Servlet which access EJBs. People will be connecting to Servlet which internal will connect to EJB and return the response.
To access the EJB I need to initialize the context. I believe code looks something around below lines.
private void doSomething() {
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(Context.PROVIDER_URL,"iiop//host:port");
Object obj;
try{
InitialContext ctx = new InitialContext(env);
obj = ctx.lookup("EjbSample");
} catch(Exception ne){ ... }
}
My questions here are:
where can I find
iiop//host:port
host and port to connect EJB. Somewhere in WebSphere Admin Console? Any Config file?As I have 3 node setup. I have 2 Clusters with name ClusterServlet and ClusterEJB in each node. Will the IIOP host and port vary node to node or these are consistent across both nodes?
[Edit 1]: When I try to access EJB from same host on which WAS is running, I am getting following error
javax.naming.NameNotFoundException: Name "EjbSample" not found in context "serverlocal:CELLROOT/SERVERROOT