2

Supposing a classical 3-tier JavaEE architecture like this

  • JSF / JSP / Servlets (Web)
  • EJB (Biz)
  • DB (Persistence)

All JavaEE tutorial examples show the web and biz layers in different containers, but in the same JavaEE server.

Is there any situation where there is an advantage to keep the EJBs apart, in their own machine? In this case, supposing they're going to communicate with the web tier via RMI, is there any kind of JavaEE container that manages EJBs but not JSP and servlets?

Leo
  • 6,480
  • 4
  • 37
  • 52
  • 1
    I'm sure there is "a" situation. I think primarily projects much larger than I work on, so I can't tell you when to switch to using multiple containers. If you have to ask, though, I'd say you don't have to worry about it. – markspace Nov 04 '14 at 18:43

1 Answers1

2

Is there any situation where there is an advantage to keep the EJBs apart, in their own machine?

Sometimes, specifics non-functional requirements can determine your app design. For example, security: in order to achieve some security norms, the business layer has to reside in a more secure server not exposed directly to Internet.

Availability: if your business layer exposes some services consumed by a different client than the web server, and these services offer some kind of mission-critical functionality, probably they need to run on a 24/7 server.

I'm not sure that think in terms of "advantage" is the correct way to see this kind of decoupled architecture. I think that is more like a price (which is translated in a more complex design) that you have to pay if you need achieve this kind of requirements.

is there any kind of JavaEE container that manages EJBs but not JSP and servlets?

Yes, for example OpenEjb.

Gabriel Aramburu
  • 2,951
  • 2
  • 16
  • 20
  • 1
    Yes, good examples. Additionally, you might have `n` webservers and `m` clustered EJB servers for horizontal scaling. If you business methods are "heavy", you might need more EJB instances than web frontends, and thus you may have `n < m`. – Alexander Langer Nov 05 '14 at 06:57