users@glassfish.java.net

GlassFish v2ur1: JMS issue

From: <glassfish_at_javadesktop.org>
Date: Thu, 10 Jan 2008 00:47:16 PST

Hi,

I have a JMS standalone application that sends Messages to a queue, those messages are really ObjectMessages that transport a Serializable java object. On the other side I have a MDB "attached" to that queue (with Auto-acknowledge). The messages are sent fine, the MDB is processing fine, until some Exception is thrown through the MDB OnMessage function (the Exception is really thrown by a local method of a session bean that the MDB calls, that function performs an em.persist after some processing). The problem is big, because the container catches the Exception and the message is redelivered to the queue, then the MDB gets the message again, the Exception is thrown again, and the process never stops until I stop Glassfish. In the Logs I can see that Glassfish redelivery attemps are just 1, and i even see a log that says: "Message returned & marked for routing to the DMQ". Nevertheless it seems that the message is not acknowleged, and the MDB receives the Message forever. I don't know if this could be the cause, but just after the logs:

[i][#|2008-01-08T12:31:26.683+0100|WARNING|sun-appserver9.1|javax.enterprise.system.stream.err|_ThreadID=16;_ThreadName=p: thread-pool-1; w: 36;_RequestID=a61110b3-c468-47f9-8b22-b21c31f591c3;|
MQRA:OMR:run:Message returned & marked for routing to the DMQ|#]

[#|2008-01-08T12:31:26.683+0100|WARNING|sun-appserver9.1|javax.enterprise.system.stream.err|_ThreadID=16;_ThreadName=p: thread-pool-1; w: 36;_RequestID=a61110b3-c468-47f9-8b22-b21c31f591c3;|
MQRA:OMR:run:omrId=0:Acked Undeliverable-Msg=com.sun.messaging.jms.ra.DirectObjectPacket_at_b1221b|#][/i]

...there is another log:

[i][#|2008-01-08T12:31:26.714+0100|INFO|sun-appserver9.1|javax.enterprise.system.stream.out|_ThreadID=14;_ThreadName=Session9102363464534313984;|
DirectConsumer:Caught Exception delivering messagecom.sun.messaging.jmq.io.Packet cannot be cast to com.sun.messaging.jms.ra.DirectPacket|#]
[/i]

...and just after this wierd Exception comes the "OnMessage" again:

[i][#|2008-01-08T12:31:26.714+0100|FINE|sun-appserver9.1|com.inelcom.icor.adif.ejb.alarmas.ReceptorAlarmasBean|_ThreadID=15;_ThreadName=p: thread-pool-1; w: 37;ClassName=com.inelcom.icor.adif.ejb.alarmas.ReceptorAlarmasBean;MethodName=onMessage;_RequestID=9eed6a05-cbee-4049-9e9e-924834e1e016;|--->onMessage()|#][/i]

NOTE: the jms-service type is EMBEDDED, and my OnMessage is:

    public void onMessage(Message message) {
        theLogger.fine("--->onMessage()");

        if(message instanceof ObjectMessage) {
            try {
                Object obj = ((ObjectMessage) message).getObject();
                theLogger.fine(obj.toString());
                afl.procesaTrap((TrapAlarma) obj);
            } catch (JMSException ex) {
                theLogger.warning(ex.getMessage());
            } catch (Exception e) {
                theLogger.warning(e.getMessage());
                throw new EJBException(e);
            }
        }
        
        theLogger.fine("<---onMessage()");
    }

Thanks!
[Message sent by forum member 'abelmj' (abelmj)]

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