File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MDB’s are fired before the resources

 
sai rama krishna
Ranch Hand
Posts: 411
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 411
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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/
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic