It's ok.
I use Jsp to access EJB. First time I cancel this line code in Jsp:
p.put(Context.PROVIDER_URL,"*******");
At that time ,the client always find JNDI in local machine.
Later,I added
p.put(Context.PROVIDER_URL,"localhost:1100");//1100 is my HA-JNDI port,then it's ok.
But I feel in cluster, it's not need to set PROVIDER_URL. I don't know why.
Hello,
can you post your jsp please? I have not been able to make my cluster work with jsp.
J.
<%
StatelessEvery stateless = null;
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
p.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
p.put(Context.PROVIDER_URL,"localhost:1100");
InitialContext ic = new InitialContext(p);
Object objRef = ic.lookup("StatelessEveryBean");
StatelessEveryHome home = (StatelessEveryHome)PortableRemoteObject.narrow(objRef, StatelessEveryHome.class);
stateless = home.create();
%>
stateless
<h1>
Number1:
Number2:
</h1>
<%
String str1 = request.getParameter("num1");
String str2 = request.getParameter("num2");
if(str1!=null&&str2!=null&&str1.length()>0&&str2.length()>0){
int num1=new Integer(str1).intValue();
int num2=new Integer(str2).intValue();
%>
sum is <%= stateless.cal(num1,num2) %> .
<%
}
else{
%>
sum is NULL.
<%
}
%>
------------------------------
Other question: the jsp must deploy in all-module? otherwise,how to find other nodes' jndi?