Glassfish and support and the community (solution for remote lookups of EJBs)
Hi,
two days ago I've written in this blog about an issue regarding the remote lookup of EJBs. It's still not clear if it is a bug or not. Nevertheless I found a solution or workaround if you want so.
Before I present the solution I want to praise the Glassfish team (mainly Sun employess) and the community. They are very helpful and in this case they also have been very responsive.
On Monday I've opened a case in the issue tracker: https://glassfish.dev.java.net/issues/show_bug.cgi?id=1643
One hour later I got the first response. Someone asked for details and has given a few advices. The same day three other people contacted me and tried to help me and discussed the problem. Whereelse do you get such support? This was really very impressive. This gives a lot of confidence in using Glassfish even in production.
And here comes the solution or workaround:
1) If you have a session (target) bean as in my case, then give it a mappedName as followe:
@Stateless(mappedName="ejb/FooJNDI")
2) In my servlet (client) I had to declare the dependency as follows
import javax.ejb.EJB;
@EJB(name="ejb/Foo", beanInterface=Foo.class,
mappedName="corbaname:iiop:: #ejb/FooJNDI")
public class BarBean ...{
public void someMethod() {
ctx = new InitialContext();
Foo foo = (Foo) ctx.lookup("java:comp/env/ejb/Foo");
Note host and port are target's host and port.
This solution/workaround is necessary to lookup beans located in different Glassfish containers which are e.g. on different host machines.
Labels: glassfish
