users@glassfish.java.net

JMS Trouble

From: <glassfish_at_javadesktop.org>
Date: Fri, 29 Feb 2008 04:56:39 PST

Hello,

I am getting the exception:

DirectConsumer:Caught Exception delivering messagecom.sun.messaging.jmq.io.Packet cannot be cast to com.sun.messaging.jms.ra.DirectPacket

and some warning messages

MQJMSRA_MC2001: createConnection API used w/ username, password for Container Auth

The message is delivered to my message driven bean *sometimes*

Here is my code:

        Context ctx = new InitialContext();
        ConnectionFactory connectionFactory = (ConnectionFactory) ctx.lookup("jms/MailQueueFactory");
        Queue queue = (Queue) ctx.lookup("jms/MailQueue");
        javax.jms.Connection connection = connectionFactory.createConnection();
        connection.start();
        javax.jms.Session session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE);
        MessageProducer messageProducer = session.createProducer(queue);
        TextMessage message = session.createTextMessage();
        message.setText("message");
        messageProducer.send(message);
        
        messageProducer.close();
        session.close();
        connection.close();

Note that although I am looking the queues from initial context, I tried making a resource descriptor with queues and I still get the same error.

Any ideas? Also are there any examples for MDBs that are recent? my code used to work not until long ago.

Best
[Message sent by forum member 'segfault2007' (segfault2007)]

http://forums.java.net/jive/thread.jspa?messageID=261607