Hello,
Thanks for your review. Here I need to monitor the ejb nodes, so I try this
code:
Properties props = new Properties();
props.setProperty(Context.INITIAL_CONTEXT_FACTORY,
"org.apache.openejb.client.RemoteInitialContextFactory");
props.setProperty(Context.PROVIDER_URL, "ejbd://" + ip + ":"
+ port);
props.setProperty(Context.SECURITY_PRINCIPAL, userName);
props.setProperty(Context.SECURITY_CREDENTIALS, password);
...
Context ctx = new InitialContext(props);
Firstly, I tried a wrong ip. Yes, I got the expected exception.
Secondly, I tried a right ip. It's OK, still right.
Thirdly, I tried the wrong ip again, it also ran well. Here I was confused
and looked into the code of openejb and found something in
package org.apache.openejb.client.
In method Client.processRequest() the code always consider we are in a
clustering environment and put the only server in a ClusterMetaData.
But in the default connection strategy StickyConnectionStrategy, this part
of code will never run.
if (locations.length == 0){
return connect(server.getLocation());
}
I guess this code wants to deal with the non-clustering environment, is that
a conflict with Client.processRequest()?
Can we provide an api to connect to a non-clustering environment?
Or may there is a way already, please tell me. ^_^
Thanks!
-Siqi
|