I have some cleanup code which may try to refer to an (stateful) EJB that doesn’t exist. For example:
try{
//In my case ejb is actually a delegate. Not sure this makes a difference
ejb.doSomeMethod();
}catch(NoSuchEJBException nsejb){
//Deal with this but continue
}
However the NoSuchEJBException is causing a transaction rollback.
Is there a way to prevent the rollback or to check if ejb no longer exists?
Well, you could run that code in a new transaction which then gets rolled back but won’t affect the outer transaction.