Tuesday, May 29, 2007

Using the deploy.last folder on JBoss

The project I am involved with, makes extreme use of JMX (MBeans). Actually the functionality residing in the JMX services is more complex comparing with the EJB layer. All these services during startup have to be deployed properly and in order, becaure there are several dependencies either between them or with services of the Application server.

I had a case where I was using the Scheduler Service and a Schedulable MBean. In the SchedulableMBean I was making use of JMS, ConnectionFactories and I was pushing messages to the EJB layer. During deployment the Scheduler was deploying first while the JBoss JMS infrastructure was not operational - yet. (I had the StartAtStartup attribute set to true). So for a couple of seconds the very first performs() of the Schedulable Service, I had exceptions because no queue was operational. I spent some minutes trying to resolve the issue with dependencies (depends tags) though I have to admit I could not resolve the problem tottaly. My last workaround was the deploy.last directory.

1. Create a folder inside the /server/default/deploy with the following name 'deploy.last'
2. deploy (copy) your sar or service descriptors inside this path
3. Eventually JBoss will obbey this, and magic some of the services will be deployed.

In that way I was making sure that all the JMS stuff/ Queues MDBs were operational before the schedulers and timers start ticking!

Its not a bad workaround, though I have to spent some more time at some point resolving the actuall dependency. @todo

No comments:

Post a Comment