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.
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.
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.