Meaningless Drivel is fun!*
The moose likes EJB and other Java EE Technologies and the fly likes ServiceLocator on the web tier and the EJB tier Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "ServiceLocator on the web tier and the EJB tier" Watch "ServiceLocator on the web tier and the EJB tier" New topic
Author

ServiceLocator on the web tier and the EJB tier

Stephen Suen
Ranch Hand

Joined: Oct 30, 2003
Posts: 34
Sun PetStore 1.4 demonstrates two difference ServiceLocator implementations for the web tier and the EJB tier:

com.sun.j2ee.blueprints.servicelocator.web.ServiceLocator
com.sun.j2ee.blueprints.servicelocator.ejb.ServiceLocator

The one for the web tier uses the "singleton" strategy and also the "caching" strategy.

I wonder that why we need two different implementations. Is there any problem if we use a single one implementation that uses a cache for both web tier and EJB tier?

Any help will be appreciated.

Stephen
Valentin Tanase
Ranch Hand

Joined: Feb 17, 2005
Posts: 704
Hi Stephen,

Not sure if I can help you much since I don�t remember much about PetStore application and the only thing I remember is that PetStore is probably one of the best examples proving that J2EE in general and Sun design patterns in particular are such low quality software solutions. This gave Microsoft the possibility to develop their .NET PetShop counterpart that uses 10 times less amount of code and performs several times better, while it provides the same functionality. It�s also funny when you think that were people trying to improve the PetStore app, but they used different patterns and practice that were forbidden by Sun. What a mess�
Hence my first advice to you would be to look somewhere else for design patterns and don�t take it very hard to understanding PetStore.
On the other hand, without pretending I�ll give you the right answer, one good reason to have two different service locators, is because the web tier has two possibilities: to access the ejbs through remote or local interfaces, depending upon the clustering architecture, or simply if the web server and ejb container runs in different jvms. As for the ejb service locator, it supposes to use always the local interfaces, since the application uses a session fa�ade.
Regards.


I think, therefore I exist -- Rene Descartes
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: ServiceLocator on the web tier and the EJB tier
 
Similar Threads
Location of ServiceLocator
Why 2 ServiceLocator Patterns, one for web and one for EJB?
why use two servicelocator?
Where should Business Delegate be ?
About ServiceLocator