It seems like the ServiceLocator "pattern" was gone. Well, it is partially true. In my opinion it was never a real pattern :-) and in the Java EE 5 spec it is only required in specific cases. The problem here: Dependency Injection only works in managed classes (Backing Beans, Session Beans, Application Clients). All other classes still have to use the Plain Old Lookup Mechanism (shortly: POLM :-)) ...and a kind of Service Locator. There is the next problem: JNDI naming isn't standardized, which I described in this post with some comments from Gavin King.
For this reasons I demoted the Service Locator to a simple utility, pimped it up with generics and renamed it to: LookupUtility. It uses internally the JNDINamingHelper which computes the JNDI-Names from the remote interfaces. You can download the code from the java.net project "Patterns For Java EE 5", or p4j5.
Thanks to Paris, for his comment. He had similar issues with Struts (is not managed by Java EE 5). This is one of many reasons why to use JSF :-).
Web Apps, SPA, PWA with vanilla Java Script (ES 6+), CSS 3 and WebStandards only. As simple as possible, but not simpler. See you at: (Progressive) Web apps, Single Page Apps and WebStandards airhacks workshops at MUC airport, Winter Edition
airhacks.fm the podcast:
Stay in touch: airhacks.news.