Fran�ois Charoy pointed me in the right direction.
When I switched from using an ObjectMessage to using a MapMessage, things
started working. Yea!
I suspect it was some kind of silent class loader problem. The class I was
serializing was defined by my EJB jar ... I suspect that the container was
unable to instantiate it because of classpath issues. I wish I new how to
enable more debugging output on the container w.r.t. message driven beans.
> -----Original Message-----
> From: Ship, Howard
> Sent: Thursday, June 21, 2001 9:30 AM
> To: jBoss User (E-mail)
> Subject: Message Driven Beans
>
>
> I'm just starting to experiment with message driven beans in
> jBoss. I'm having a problem though.
>
> One of my business processes uses a queue to send a message
> to MDB. The session bean coordinates a database update, the
> MDB sends e-mail about it and I wanted them decoupled.
>
> Excerpts from ejb-jar.xml:
>
> <message-driven>
> <ejb-name>MailQueue</ejb-name>
> <ejb-class>com.primix.vlib.ejb.impl.MailQueueBean</ejb-class>
> <message-selector/>
> <transaction-type>Container</transaction-type>
> <message-driven-destination>
> <destination-type>javax.jms.Queue</destination-type>
> <subscription-durability>NonDurable</subscription-durability>
> </message-driven-destination>
> </message-driven>
>
> <container-transaction>
> <method>
> <ejb-name>MailQueue</ejb-name>
> <method-name>*</method-name>
> </method>
> <trans-attribute>Required</trans-attribute>
> </container-transaction>
>
> I inserted
>
> <Queue>
> <Name>Vlib-MailQueue</Name>
> </Queue>
>
> into jbossmq.xml
>
>
>
> At runtime, I see the message getting queued without error
> (I've even stepped through in the debugger):
>
> private QueueSender mailQueueSender;
> private QueueSession mailQueueSession;
>
> protected QueueSession getMailQueueSession()
> throws NamingException, JMSException
> {
> if (mailQueueSession == null)
> {
> Context context = new InitialContext();
>
> QueueConnectionFactory factory =
> (QueueConnectionFactory)context.lookup("QueueConnectionFactory");
>
> QueueConnection connection =
> factory.createQueueConnection();
>
> mailQueueSession =
> connection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
> }
>
> return mailQueueSession;
> }
>
> protected QueueSender getMailQueueSender()
> throws NamingException, JMSException
> {
> if (mailQueueSender == null)
> {
> Context context = new InitialContext();
>
> Queue queue =
> (Queue)context.lookup("queue/Vlib-MailQueue");
>
> mailQueueSender =
> getMailQueueSession().createSender(queue);
> }
>
> return mailQueueSender;
> }
>
> protected void sendMail(String emailAddress, String
> subject, String content)
> throws EJBException
> {
> try
> {
> QueueSender sender = getMailQueueSender();
>
> QueueSession session = getMailQueueSession();
>
> MailMessage message = new
> MailMessage(emailAddress, subject, content);
>
> ObjectMessage queueMessage =
> session.createObjectMessage(message);
>
> System.out.println("Sending message: "
> + queueMessage + " via " + sender);
>
> sender.send(queueMessage,
> DeliveryMode.PERSISTENT, MAIL_QUEUE_PRIORITY, 0);
> }
> catch (NamingException ex)
> {
> throw new XEJBException(ex);
> }
> catch (JMSException ex)
> {
> throw new XEJBException(ex);
> }
> }
>
>
> In C:\JBoss-2.2.2\db\jbossmq I see a
> [EMAIL PROTECTED]
> file.
>
> However, my message driven bean is never instantiated or has
> onMessage() invoked.
>
>
> public abstract class AbstractMessageDrivenBean
> implements MessageDrivenBean, MessageListener
> {
> private MessageDrivenContext context;
>
> public void setMessageDrivenContext(MessageDrivenContext value)
> throws EJBException
> {
> System.out.println(this + " set context to " + value);
>
> context = value;
> }
>
> /**
> *
> * Does nothing.
> *
> */
>
> public void ejbCreate()
> throws EJBException
> {
> }
>
> /**
> * Does nothing.
> *
> */
>
> public void ejbRemove()
> throws EJBException
> {
> }
> }
>
> public class MailQueueBean
> extends AbstractMessageDrivenBean
> {
> private static final Category CAT =
> Category.getInstance(MailQueueBean.class);
>
> public void onMessage(Message message)
> {
> System.err.println("Received message: " + message);
> }
> }
>
>
> At runtime, I see the output about the message being queued
> (by my session bean), but I never see anything about my MDB.
>
> I've been playing with various parameters and configurations,
> hoping to stumble across the proper configuration, with no
> luck so far. I'm sure its something ovious, but I don't see
> it. Any help?
>
> Howard Ship
> Senior Consultant
> PRIMIX
> 311 Arsenal Street
> Watertown, MA 02472
> www.primix.com
> [EMAIL PROTECTED]
> (617) 923-6639
>
>
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-user