two simple jBoss - Problems

Usually I’m not posting this kind of topics here but this two problems kept me on fire at work for some hours.

Scenario: jBoss 4.2.2GA + MessageDrivenBeans

Problem 1:

Out of nowhere came the problem that when starting jBoss the MDB couldn’t start with the error:

jboss.mq:service=DestinationManager is not registered.

This might have multiple reasons but in my case the problem was that when more jBoss exists in the same network they connect to a cluster (at least in our configuration). That means that the destination-manager is only created on the first computer of the cluster. To prevent this you can specify a partition when starting jBoss and you have only a one computer cluster (as long noone uses the same partition)

So here is the magic line:

run.bat -c all -g yourPartitionName

The -g parameter is for specifing the partition to use. -c specifies the jBoss-configuration

Problem 2:

Once the MDB is started and registered to a queue it starts to process the queue if there are still messages in it. (Maybe jBoss crashed for some reason before finishing the queue). That can be a problem if the behaviour of the message depends on an EJB that is not loaded yet. For that you can use the @Depends annotation in your MDB.

e.g.

@Depends(value=”jboss.j2ee:ear=YourEJB.ear,jar=YourEJB.ejb3,name=YourFacadeBean,service=EJB3″)

or for multiple dependencies (didn’t test that yet):

@Depends({
“jboss.j2ee:ear=myEar.ear,jar=myJarFile.jar,name=MySessionBean1,service=EJB3″,
“jboss.j2ee:ear=myEar.ear,jar=myJarFile.jar,name=MySessionBean2,service=EJB3″
})

(found this here)

After adding this the service is only created if the specified MBean is already registered. You can find the corresponding name for you MBean on startup (or server.log). Just keep looking for “[org.jboss.ejb3.JmxKernelAbstraction] installing MBean: ……”

Well,…seems like two easy issues not worth mentioning. But nevertheless you have to know it Hope I could help someone with that.

PS: Sry for the formatting terror!