I've multiple questions regarding using serviceLocator with Session facade.
Let's say you're using a business delegate that uses ServiceLocator to locate EJBs. Now, if you've your CMP beans wrapped under session facade then the ServiceLocator will find the session facade bean. But from session facade's standpoint, it itself needs to locate the CMP. At this standpoint, the problem forks into two areas:
1- The CMP is local to session facade. They both are deployed on same app server in an .ear or .jar file. In this scenario, does session facade needs to use serviceLocator to get the Local ejb?
2- CMP and session facade are remote to eachother. Obviously, session facade does need serviceLocator in this case to locate remote CMP ejb. In that case, isn't the servicelocator being used twice (bus delgate -> serviceLocatr -> session facade -> serviceLocator -> CMP ejb)? Is that a good model? What are the alternatives? Thanks.
A1: I advocate the use of the Service Locator pattern even for local lookups, but it is not strictly necessary, and the advantages for local lookups are much smaller.
A2: The double-use of the service locate is appropriate, because you are crossing two network boundaries: client-to-session-layer, session-layer-to-CMP-layer. I would strongly suggest that you *not* split your session and CMP EJB onto two separate machines, though. This re-introduces all of the problems that Session Facade is supposed to solve.
Instead, put all your EJBs in a single application. If you need to load-balance, cluster that application rather than splitting your EJBs.