This is a weird situation. Let me explain it as best as I can.
I have an interface Client
which has methods which throw a Custom Exception.
My EJB3 Remote extends this interface Client
and was annotated @Remote
.
My EJB3 Bean used to extend the Remote and was annotated @Stateless
.
Now comes the weirdness. Due to a very specific issue I cannot deploy any EJB3 jars on my app server. (The question is not how I resolve this deploy issue.)
Now I have to downgrade the code from EJB3 to EJB2.
Since all the methods in my Remote Interface have to throw a RemoteException
(EJB2 Spec) , I cannot extend from my Client
Interface any more.
The option that I am left with is creating a EJB2Wrapper, which can extend from the Client
interface and in each method I call into the Remote Interface.
This creates the ugly try catch block for each method, since I have to catch the RemoteException
.
Is there a better way to do this?