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
--
QUIPSY QUALITY GmbH & Co. KG
Ein Unternehmen der MES-Gruppe
Stuttgarter Strasse 23
D-75179 Pforzheim
Tel: 07231-9189-52
Fax: 07231-9189-59
www.quipsy.de
karg_at_quipsy.de
Registergericht Mannheim HRA 701214
Geschäftsführer: Nils Schroeder
Diese E-Mail enthält persönliche, vertrauliche und vor Weitergabe geschützte Informationen und ist ausschließlich für den vorgesehenen o.g. Empfänger (Adressaten) bestimmt. Falls Sie diese E-Mail versehentlich erhalten haben und nicht der vorgesehene Empfänger sind, bitten wir Sie, die E-Mail und deren Anhänge nicht aufzubewahren, nicht zu vervielfältigen, nicht zu nutzen und nicht weiterzugeben. Bitte informieren Sie uns als Absender über diesen Zustellungsfehler und löschen Sie die E-Mail.