Search code examples
deploymentqueuewebspheremessage-driven-beanzos

Binding a queue to an EJB 3.0 MDB in WebSphere 7


I'm writing, or trying to write, Baby's First MDB on WebSphere 7. I have nearly no hair left, having pulled it all out trying to get the thing to work. It appears that I've got everything set up right, but I get no response when I put a message to the associated queue.

Here's the EAR file setup:

simplemdb.ear
    META-INF
        Manifest.mf
        application.xml
    simplemdb.jar
        META-INF
            Manifest.mf
            ejb-jar.xml
        com
            [ classes go here ]

I can't find any syntax for defining the queue's JNDI name in ejb-jar.xml, so instead I:

  • Define a WebSphere activation spec. Name SimpleMDBActivationSpec, JNDI name jms/SimpleActivationSpec, Destination jms/SimpleMDBQueue.
  • Define a WebSphere queue. Name SimpleMDBQueue, JNDI name jms/SimpleMDBQueue, Queue name SIMPLE.MDB.QUEUE.
  • Define an MQ queue, name SIMPLE.MDB.QUEUE.
  • Deploy the EAR file. During the deployment, I'm asked to enter binding information. I select Activation Specification, then point the Target Resource JNDI Name and Destination JNDI name at the activation spec and queue, respectively.

(The MDB code has no annotations.) At this point, the app points to the spec and queue, and the spec points to the queue - belt and suspenders. Naturally, I imagine that the app therefore knows about the queue. Full of hope, I put a message on the queue, and ... nothing. The onMessage event is supposed to use System.out to log a message. I see no message.

Clear documentation on this is conspicuous by its absence. Google gives LOTS of results, but none of them details how the configuration all fits together. There's lots of hand-waving about ibm-ejb-jar-bnd.xmi, but examples of the file are arcane, full of opaque numbers with no explanation about how they were generated, or how they relate to other parts of the configuration.

For goodness' sake. All I want to do is deploy an MDB, and have it write "Hello, world" when I put a message to a queue. I'm using vi and ant as my development and build tools. Can anybody out there give me an idea about what I'm missing?

Edit: "zos" tag added.


Solution

  • I found the problem. It's specific to WebSphere running on z/OS. For an activation spec to be fully available in that environment, the Control Region Adjunct (CRA) process must be started. I told WAS to start it up, recycled the app server, and lo! My MDB started responding.

    To make the CRA start via the WebSphere Admin Console, go to ...

    • Application servers > [server name] > Communications > Messaging > WebSphere MQ CRA Settings

    ... and check the box that says "Start CRA". Hit OK, save it to the master configuration, and to make the CRA actually start, bring the app server down and back up. (This is for WAS 7.0.)

    Thanks to everyone for their time and thoughtspace.