I would like to create an exception handler for a specific case that happens when an EJB client application loses connection with the application server. The code we create is able to process the client application in a way convenient for the user to try to connect to the same server or another server in a failed environment. “Lost Communication” means anything that requires reconnection. The cause may be a network problem, server blocking, down service, etc.
Here is the idea of what we are looking for (client code):
private void doSomething() throws RecoverableException {
BusinessRemoteEJB ejb=ctx.lookup("BusinessRemoteEJB");
try {
List<product> list=ejb.getProducts();
} catch (EJBException e){
Exception e = e.getCausedByException();
if(e !=null && e instanceof EJBConnectionException){
throw new RecoverableException(e);
} else {
throw e;
}
Of course, an EJBConnectionException does not exist. Is there anything similar?
OpenEJB 1.4 ( EJB 3.x). , , , .
, , , .