Skip to main content

MDB(Message Driven Bean) failing on server startup

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
Roland2
Offline
Joined: 2014-06-03

Hello,

I've already posted this question on SO:
http://stackoverflow.com/questions/24033872/mdbmessage-driven-bean-faili...

Several people seem to have the same problem(see links at the bottom):

If you startup a glassfish(v 4) server with an MDB(Message Driven Bean) and there are messages to be consumed, the MDB will start consuming the messages while the container is still initializing. If the message processing requires any other service from the container it will throw an exception:

Caused by: javax.ejb.EJBException: Attempt to invoke when container is in Initializing
Has anyone managed to solve this problem?

Ideally the MDB should only start consuming messages after the container is fully initialized.

Is there a way to let the MDB check for container initialization and only start accepting messages when the container is up and running?

Thanks for any feedback!

Links:
http://stackoverflow.com/questions/3052081/problem-with-seam-and-mdb-on-...
https://community.jboss.org/thread/191330?start=0&tstart=0