users@glassfish.java.net

Re: Why is MDB not firing?

From: Ramesh <Ramesh.Parthasarathy_at_Sun.COM>
Date: Thu, 10 Apr 2008 13:37:33 +0530

Hi Markus,
    Does the destination MY_TOPIC have the message that you sent from
the swing client, also could you verify if there is an active consumer
for the destination.
You could do this by either using the $GF_HOME/imq/bin/imqadmin tool
or using the "$GF_HOME/imq/bin/imqcmd query dst" command.

Thanks
-Ramesh
Markus KARG wrote:
> I have written a small JMS sample using Java EE 5 SDK and try running
> it on the default GlassFish instance. A Swing Client (WebStart'ed) is
> sending a TextMessage into a topic (no exception thrown, no log
> entries). A MDB is listening on the topic (no exception thrown, no log
> entries). Can verify and deploy without any problems. But: The MDB
> does never walk into onMessage! I couldn't believe it, so I added
> both, logging and showing a message box as the very first line of
> onMessage. Both never happens. I thought it might be a typo in
> mappedName annotation, but as soon as I change the mappedName, I
> cannot deploy anymore, so the name IS correct (since I do not get ANY
> verify, deploy or runtime log entries).
>
> Please help, I am totally confused. I am using JMS on JOnAS 4.x for
> years, but I just can't get it running on GlassFish.
>
> Where's my fault?
>
> Here is the code for sending:
>
> @Resource(mappedName = "MY_CONNECTION_FACTORY")
> private static ConnectionFactory connectionFactory;
>
> @Resource(mappedName = "MY_TOPIC")
> private static Topic topic;
>
>
> try {
> final Connection connection =
> HelloClient.connectionFactory.createConnection();
> final Session session =
> connection.createSession(true, Session.AUTO_ACKNOWLEDGE);
> final MessageProducer producer =
> session.createProducer(HelloClient.this.topic);
> final Message msg =
> session.createTextMessage("JMS-Test Text Message");
> producer.send(msg, DeliveryMode.PERSISTENT, 3, 0);
> JOptionPane.showMessageDialog(null, "OK", "Test
> Titel", JOptionPane.OK_CANCEL_OPTION);
> } catch (final Throwable e) {
> JOptionPane.showMessageDialog(null, e.getMessage(),
> "Test Titel", JOptionPane.OK_CANCEL_OPTION);
> }
>
> (when running, it always shows "OK" but never an Exception)
>
> and here is the MDB code:
>
> package example.mdb;
> import javax.ejb.MessageDriven;
> import javax.jms.Message;
> import javax.jms.MessageListener;
> import javax.swing.JOptionPane;
> @MessageDriven(mappedName = "MY_TOPIC")
> public class TestMDB implements MessageListener {
> public void onMessage(Message arg0) {
> // For debug purposes, added logging or MessageBox in the first
> line, but it
> // never shows up!
> }
> }
>
> I am not using deployment descriptor entries.
>
> Thanks
> Markus
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>