Search code examples
jakarta-eejbossglassfishejb-3.0failover

Failover for EJBs?


Java EE app container provide "failover" support for EJBs, in their docs never cite any reasons why you would need to failover an EJB in the first place!

When do these "failover" conditions take place and what causes them? Is this just a situation where an exception is thrown? Or is it possible for an app container to actually "lose" or "break" an EJB?

Usually, when I've spoken of failover in the past, its been a networking component like a server that goes down for some reason. I'm just having a mental block here trying to envision what would cause a piece of deployed software to die and "fail over".

Bonus points for concrete examples instead of just fuzzy, vague, abstract descriptions (!).


Solution

  • Java EE in general does not provide such kind of failover that you talk about. If it's supported at all, then it's a proprietary feature of a specific implementation.

    Typically such failover would be for remote EJBs which run on some server, which itself can crash or become unavailable because of network problems. In such a case, the client application server can have several failover URLs specified so that if one server becomes unresponsive another will automatically be used instead in a way that's transparent to the code that wants to talk to said bean.

    The same mechanism can also be used for a basic load-balancing. If the server on which the remote EJB that your code wants to contact lives is under high load, the client AS can automatically choose a server that runs the same remote bean, but is under less load.