Two Laptop Bag*
The moose likes EJB and other Java EE Technologies and the fly likes MDB’s are fired before the resources Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "MDB’s are fired before the resources" Watch "MDB’s are fired before the resources" New topic
Author

MDB’s are fired before the resources

sai rama krishna
Ranch Hand

Joined: May 29, 2009
Posts: 223
Hi,

I am facing problem of Message driven beans fired before the resources(hibernate, property files etc) are initialized by the startup bean. I am using websphere application server 7.0.0.2.


How to avoid MDB’s are fired before the resources are initialized by the start up bean.


any ideas, links, resources, sample code highly appreciated. thanks in advance
sai rama krishna
Ranch Hand

Joined: May 29, 2009
Posts: 223
I found below link

http://stackoverflow.com/questions/13142246/suspend-mdb-message-processing-until-startupbean-has-finished-initialization

above link talks about JBoss Server 7. I am using websphere 7.0.0.7 though. Does that work with Websphere application server 7.0.0.11 as well. Please advise.
I thought of using ejbPostCreate(). But

Based on below link
http://www.geekinterview.com/question_details/659


MDBs do not have

ejbPostCreate()



I am thinking to Add a thread delay in the initialisation of the MBean, hoping that all resources will be initialised by the time the delay is finished. But not sure if that is good approach.
what would be work around solution for this problem.

Please advise
Ganesh Malaichamy
Greenhorn

Joined: Feb 11, 2011
Posts: 27
MDB does have @PostConstruct. Did you tried using that and tested the behavior.
http://answers.oreilly.com/topic/2156-enterprise-javabeans-31-the-lifecycle-of-a-message-driven-bean/
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MDB’s are fired before the resources
 
Similar Threads
Statefulness using JMS
How to configure number MDB Beans in a Pool in Jboss
Getting error in petclinic application for datasource
Difference between @EJB and @Resource
JMS Connection Pool