About Question enthuware.oce-ejbd.v6.2.501 :

Moderator: admin

Post Reply
ETS User

About Question enthuware.oce-ejbd.v6.2.501 :

Post by ETS User »

Hello,

Regarding the question of MDB:

...
public void onMessage(Message message) throws java.rmi.RemoteException
...

The answer is "This is an invalid (i.e. non-compliant) EJB 3.x message driven bean."
A 3.x MDB is not allowed to throw RemoteException.


so, what types of exceptions are allowed to be in its throws clause ? :?:

thanks

admin
Site Admin
Posts: 10388
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.501 :

Post by admin »

Actually, it cannot throw any checked exception because MessageListener's onMessage does not declare any exception. But it is free to throw any RuntimeException.

However, the specification explicitly mentions that it must not throw the java.rmi.RemoteException and should not, in general, throw RuntimeExceptions.

You might want to take a look at Section 5.4.17 (Dealing with Exceptions) for more details.

HTH,
Paul.

himaiMinh
Posts: 358
Joined: Fri Nov 29, 2013 8:26 pm
Contact:

Re: About Question enthuware.oce-ejbd.v6.2.501 :

Post by himaiMinh »

According to 5.4.18 of the spec, MDB can throw RuntimeException that is not an application exception.

So,
MDBs should not in general throw RuntimeException.
I believe it should be application exception because there is no client to catch it.
But I believe it is possible for MDB to throw a system exception and the container will discard the bean.

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests