aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Session / Message Driven Beans load sequence Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Session / Message Driven Beans load sequence" Watch "Session / Message Driven Beans load sequence" New topic
Author

Session / Message Driven Beans load sequence

Frans van Niekerk
Greenhorn

Joined: Sep 03, 2008
Posts: 9
I have a scenario where I MDB triggers a JCA adaptor to activate. During the activation process a session bean (local interface) is looked up to do some work. The lookup process works on some machines and not on others. On the machines where it fails it indicates that the name is unbound.

This makes me think there is a bit of a load sequence difference? Is it possible to force the session bean to be deployed (and thus bound) before the MDBs are deployed during ear deployment?

I know this is not a good design, but it is an unfortunate stopgap that we have to use for the time being.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

What application server are you using? There is nothing in the specification to define a start up sequence. Most servers will have their own, e.g. JBoss has a deployment order you can use, WebSphere has startup beans etc. If its just a stop gap using one of these is probably the quickest.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Frans van Niekerk
Greenhorn

Joined: Sep 03, 2008
Posts: 9
I am using Jboss, I will search for what you suggested, thanks.
Frans van Niekerk
Greenhorn

Joined: Sep 03, 2008
Posts: 9
Excellent, found @Depends annotation, works perfectly. (Jboss specific obvioulsy)
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Originally posted by Frans van Niekerk:
Excellent, found @Depends annotation, works perfectly. (Jboss specific obvioulsy)


Good. There are ways round this that are specification complient if you need them. You can use the only JEE component that has a the concept of startup - Servlets - to kick off your startup code for example. A heavy weight way of doing this:

  • create a servlet and servlet context listener and deploy them to your server
  • in the servlet context listner invoke a "startup" MDB (just a normal MDB where your startup initialisation code is)


  • A bit full on, since you need servlets, MDB and queues all configured just to run some startup code! In practice I find it easier to have code lazily start stuff up.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Session / Message Driven Beans load sequence