-
1. Re: Remote EJB access and initialContext?
prasad.deshpande Jan 25, 2012 4:12 AM (in response to markus78)1 of 1 people found this helpfulAny context that you create using new InitialContext(props) is very much local to the remote client. context has no information about the remote connections. Your selectors will have it (SelectorA/SelectorB). The only information that Initial context will consider is java.naming.factory.url.pkgs property. So as long as your SelectorB knows about serverA, it should work. By calling EJBClientContext.setSelector(SelectorB); you are ultimately replacing all receivers/connection information. So whether ctx.lookup(bean_on_serverA); & context.lookup(bean_on_serverB); would work or not is all depends on whether SelectorB knows about ServerA & ServerB.
-
2. Re: Remote EJB access and initialContext?
markus78 Jan 25, 2012 4:29 AM (in response to prasad.deshpande)Ok thanks! But what if we have servers with the same beans deployed on them? Is it possible to lookup on specifik server even though the selector knows about 2 servers?
-
3. Re: Remote EJB access and initialContext?
prasad.deshpande Jan 25, 2012 4:50 AM (in response to markus78)Is it possible to lookup on specifik server even though the selector knows about 2 servers?
At the moment using remoting API, I don't think so.
As a workaround you may want to try separating out selectors for two servers & try setting them just before you want to do a lookup:
EJBClientContext.setSelector(SelectorA);
ctx = new InitialContext(propsA);
ctx.lookup(bean_on_serverA);
SelectorA = EJBClientContext.setSelector(SelectorB); // when you set SelectorB, this call will return previously set selector, if any, which in this case will be SelectorA
ctx.lookup(bean_on_serverB);
// if needed set SelectorA back
SelectorB = EJBClientContext.setSelector(SelectorA);
//do the stuff with SelectorA
I haven't tried this myself, but would be worth to give a try.
Here is another user Bernd Koecke asking same thing https://community.jboss.org/message/647202#647202#647202 Will be worth to see what architects responds.
-
4. Re: Remote EJB access and initialContext?
jaikiran Jan 28, 2012 9:29 AM (in response to prasad.deshpande)I replied to a similar post here https://community.jboss.org/message/649243#649243