An exception cannot be caught when it happens in a session bean..... What does that mean exactly?
I am getting an exception in a session bean and want to catch it in the method which calls the session bean. I don't understand why it is not caught by the specific catch block for that message.
eg.
try {
// connection to session bean
LOG.debug("getting data selection start");
Context initial = new InitialContext();
Object objref = initial.lookup(EJB_WSCLIENT);
WSClientSeHomIf home = (WSClientSeHomIf) PortableRemoteObject.narrow(objref,WSClientSeHomIf.class);
WSClientSeRemIf ws = (WSClientSeRemIf)home.create();
Vector<Hashtable><String,String>> vResult = ws.getRefTableContents(strPage,phSelectionCriteria); // that's where the exception occurs
LOG.debug("getting data selection end");
return vResult;
}
catch (RemoteException e) {
LOG.error("Remote exception");
throw new DhaulagiriException(e.getMessage());
}
catch (DhaulagiriException e) { // that's the exception which actually happens and should be caught
LOG.error("Exception in Dhaulagiri");
throw e;
}
catch (CreateException e) {
LOG.error("Create exception");
throw new DhaulagiriException(e.getMessage());
}
catch (NamingException e) {
LOG.error("Naming exception");
throw new DhaulagiriException(e.getMessage());
}
catch (Exception e) { // that's the catch block which is caught
LOG.error("Exception is:" + e.getClass()); // and the exception class is DhaulagiriException
String sError = StrErrUnhandled + e.getMessage();
// LOG.error(sError,e);
throw new DhaulagiriException(sError);
}
Why is DhaulagiriException not caught, even though it is a DhaulagiriException when displaying e.getClass() ?