13 Replies Latest reply on Mar 25, 2004 6:07 PM by Elias Ross

    DLQHandler and Websphere MQ (MQSeries)

    Daniel Abramovich Newbie

      Hi all,

      We're seeing what may be an incompatibility between the JBoss (3.2.1) DLQHandler and Websphere MQ. If our MDB encounter an error more than the configured number of failures we see JBoss try and send the message to the dead letter queue. But, alas, it fails (exception at the bottom).

      The DLQhandler calls a funny method "makeWritable" which clears all of the properties of the JMS message and then tries to reset them. It's setting these properties (on a com.ibm.jms.Message) that appears to cause the problem. The thing is, I found this post

      http://mainframeforum.com/archive/1431/2002/3/173638

      "Most of the JMSX and JMS properties (including JMSXAppID) are set during the send() method - you
      can't set them programatically. Even if you could, when you send the method the contents would
      be ignored.

      Ian Parkinson WebSphere MQ Development"

      This would seems to indicate that what the JBoss DLQHandler is doing is bad form at best.

      Anyone know what the real story is? Is there a way (short of changing JBoss code) install my own DLQ handler not to set these properties? Help!

      Thanks,
      -Dan

      Exception Stack Trace:
      ---------------------------------------------------------
      2003-07-30 18:57:06,914 ERROR [org.jboss.ejb.plugins.jms.DLQHandler:Thread Pool Worker-0] Could not send message to Dead Letter Queue

      javax.jms.MessageFormatException: MQJMS1058: Invalid message property name: JMSXAppID
      at com.ibm.jms.JMSMessage newMessageFormatException(JMSMessage.java:4557)

      at com.ibm.jms.JMSMessage.setStringProperty(JMSMessage.java:5505)

      at org.jboss.ejb.plugins.jms.DLQHandler.makeWritable(DLQHandler.java:336)

      at org.jboss.ejb.plugins.jms.DLQHandler.sendMessage(DLQHandler.java:277)

      at org.jboss.ejb.plugins.jms.DLQHandler.handleRedeliveredMessage(DLQHandler.java:210)

      at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1011)

      ---snip---

        • 1. Re: DLQHandler and Websphere MQ (MQSeries)
          Daniel Abramovich Newbie

          Out of desperation I tried JBoss 3.2.2 RC2, which claims some fixes related to handling properties for the DLQHandler. Thing went from bad to worse. As soon as the message delivery fails once (i.e. the first time the DLQHandler is needed) it dies when it tries to figure out how many times the message is delievered:

          I get:
          2003-07-31 15:30:26,379 ERROR [org.jboss.ejb.plugins.jms.JMSContainerInvoker] Exception in JMSCI message listener

          java.lang.NumberFormatException

          at com.ibm.jms.JMSMessage.toInt(JMSMessage.java:5764)

          at com.ibm.jms.JMSMessage.getIntProperty(JMSMessage.java:3888)

          at org.jboss.ejb.plugins.jms.DLQHandler.handleRedeliveredMessage(DLQHandler.java:206)

          at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1106)

          at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)

          at com.ibm.mq.jms.MQSession.run(MQSession.java:1156)

          at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:182)

          at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:732)

          at java.lang.Thread.run(Thread.java:536)

          Looking at the code this isn't all that surprising since the the thing it's trying to format is the value of the property JMS_JBOSS_REDELIVERY_COUNT which doesn't appear to be part of my message:

          JMS Message class: jms_text
          JMSType: null
          JMSDeliveryMode: 2
          JMSExpiration: 0
          JMSPriority: 4
          JMSMessageID: ID:414d5120514d5f6d7365706334312020b66a293f20000701
          JMSTimestamp: 1059679846920
          JMSCorrelationID:null
          JMSDestination: null
          JMSReplyTo: null
          JMSRedelivered: false
          JMS_IBM_PutDate:20030731
          JMSXAppID:Websphere MQ Client for Java
          JMS_IBM_Format:MQSTR
          JMS_IBM_PutApplType:28
          JMS_IBM_MsgType:8
          JMSXUserID:websphere
          JMS_IBM_PutTime:19304692
          JMSXDeliveryCount:1

          Why doesn't it use JMSXDeliveryCount ??
          -Dan

          • 2. Re: DLQHandler and Websphere MQ (MQSeries)
            vojdem Newbie

            Hi,

            i also had the same problems with use of Websphere MQ as DLQ. I have managed to make it work only with small changes in the DLQHandler (attachment).
            It is not the best solution, but maybe it can help.

            • 3. Re: DLQHandler and Websphere MQ (MQSeries)
              Adrian Brock Master

              vojdem can I have the source code to your modified
              DLQHandler?

              The IBM guy is correct, most properties are set during
              the send. We don't know what those properties are so
              we just copy them all. It is a bit nannying to throw
              an Exception for this (logging a warning should be enough).

              The redelivered count property was a bug which was fixed.
              It checks for its existence now, before trying to use it.

              I've modified the DLQHandler to ignore exceptions thrown
              while trying to copy message properties. If you are
              really interested, you can enable trace logging on the
              DLQHandler to see the exceptions.

              Regards,
              Adrian

              • 4. Re: DLQHandler and Websphere MQ (MQSeries)
                vojdem Newbie

                Hi Adrian,

                the sources are in the attachment. It is based on jboss sources from release 3.0.4. (i had the problem with DLQ-MQSeries in February/March).

                regards

                Vojtech

                • 5. Re: DLQHandler and Websphere MQ (MQSeries)
                  John Casey Newbie

                  alright...I feel stupid. How can I get at these attachments? I've started using WSMQ with JBoss 3.2.3, and am experiencing the same problems with the DLQ. I'd like to get this fixed, as it will be critical in my company's adoption of JBoss (it's an integral part of our requirements, and the demo I'll have to do).

                  Can I get hold of this patch?

                  Thanks,
                  John Casey

                  • 6. Re: DLQHandler and Websphere MQ (MQSeries)
                    Adrian Brock Master

                    I don't see how you could be getting the same problem, since it has been fixed.
                    The DLQ handler now correctly checks for the existence of the property
                    before accessing it.
                    It also ignores errors trying to copy WSMQ internal properties.

                    Regards,
                    Adrian

                    • 7. Re: DLQHandler and Websphere MQ (MQSeries)
                      John Casey Newbie

                      Sorry, forgot to post a reply to before leaving work. I didn't read the error closely enough...it turned out that the example code from

                      http://sourceforge.net/tracker/index.php?func=detail&aid=753022&group_id=22866&atid=376687


                      which is meant as a tutorial (?) / patch for using WSMQ doesn't include a queue binding in the jboss-service.xml for DLQ...this was the cause of the error I was getting. I haven't had time to patch the zipfile from that URL yet, but I should have posted a reply to this forum.

                      Sorry again. Thanks for the reply.

                      -john[/url]

                      • 8. Re: DLQHandler and Websphere MQ (MQSeries)
                        kouliig Newbie

                        Adrian,

                        I still have the same problem using JBoss 3.2.3:

                        2004-03-15 18:17:45,818 WARN [org.jboss.ejb.plugins.jms.DLQHandler] Message resent too many times; sending it to DLQ; message id=ID:414d512
                        04130393420202020202020204040d5a30de1b992
                        2004-03-15 18:17:45,820 TRACE [org.jboss.ejb.plugins.jms.DLQHandler] Could not copy message property JMSXUserID
                        javax.jms.MessageFormatException: MQJMS1058: Invalid message property name: JMSXUserID
                        at com.ibm.jms.JMSMessage.newMessageFormatException(JMSMessage.java:4557)
                        at com.ibm.jms.JMSMessage.setObjectProperty(JMSMessage.java:5419)
                        at org.jboss.ejb.plugins.jms.DLQHandler.makeWritable(DLQHandler.java:371)
                        at org.jboss.ejb.plugins.jms.DLQHandler.sendMessage(DLQHandler.java:274)
                        at org.jboss.ejb.plugins.jms.DLQHandler.handleRedeliveredMessage(DLQHandler.java:233)
                        at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1105)
                        at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)
                        at com.ibm.mq.jms.MQSession.run(MQSession.java:1136)
                        at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:182)
                        at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:732)
                        at java.lang.Thread.run(Thread.java:534)

                        What changes should I do?

                        Regards,
                        Igor.

                        • 9. Re: DLQHandler and Websphere MQ (MQSeries)
                          Adrian Brock Master

                          That is a TRACE level message not an ERROR.
                          This property cannot be copied, it is set by WSMQ when the message
                          is sent to the DLQ. See the javadocs for javax.jms.Message

                          Regards,
                          Adrian

                          • 10. Re: DLQHandler and Websphere MQ (MQSeries)
                            kouliig Newbie

                            You're right, thank you, this is a TRACE, an ERROR I'm getting later.

                            In my tests the DLQ works fine if MDBs listen to the queue which I populated from MDBs,
                            but fails when MDBs listen to the MQSeries queue populated directly by our client.

                            Any idea?

                            Regards,
                            Igor.

                            ----------------------------------

                            2004-03-15 18:17:45,823 TRACE [org.jboss.ejb.plugins.jms.DLQHandler] Could not copy message property JMSXDeliveryCount
                            javax.jms.MessageFormatException: MQJMS1058: Invalid message property name: JMSXDeliveryCount
                            at com.ibm.jms.JMSMessage.newMessageFormatException(JMSMessage.java:4557)
                            at com.ibm.jms.JMSMessage.setObjectProperty(JMSMessage.java:5419)
                            at org.jboss.ejb.plugins.jms.DLQHandler.makeWritable(DLQHandler.java:371)
                            at org.jboss.ejb.plugins.jms.DLQHandler.sendMessage(DLQHandler.java:274)
                            at org.jboss.ejb.plugins.jms.DLQHandler.handleRedeliveredMessage(DLQHandler.java:233)
                            at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1105)
                            at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)
                            at com.ibm.mq.jms.MQSession.run(MQSession.java:1136)
                            at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:182)
                            at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:732)
                            at java.lang.Thread.run(Thread.java:534)
                            2004-03-15 18:17:45,824 ERROR[org.jboss.ejb.plugins.jms.JMSContainerInvoker] Exception in JMSCI message listener
                            java.lang.NullPointerException
                            at org.jboss.ejb.plugins.jms.DLQHandler.sendMessage(DLQHandler.java:279)
                            at org.jboss.ejb.plugins.jms.DLQHandler.handleRedeliveredMessage(DLQHandler.java:233)
                            at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1105)
                            at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)
                            at com.ibm.mq.jms.MQSession.run(MQSession.java:1136)
                            at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:182)
                            at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:732)
                            at java.lang.Thread.run(Thread.java:534)

                            • 11. Re: DLQHandler and Websphere MQ (MQSeries)
                              kouliig Newbie

                              You're right, thank you, this is a TRACE, an ERROR I'm getting later.

                              In my tests DLQ works fine when MDB listens to the MQSeries queue that I populated from other MDB,
                              but fails when MDB listens to the queue populated by our client.

                              Any idea?

                              Regards,
                              Igor.

                              --------------

                              2004-03-15 18:17:45,823 TRACE [org.jboss.ejb.plugins.jms.DLQHandler] Could not copy message property JMSXDeliveryCount
                              javax.jms.MessageFormatException: MQJMS1058: Invalid message property name: JMSXDeliveryCount
                              at com.ibm.jms.JMSMessage.newMessageFormatException(JMSMessage.java:4557)
                              at com.ibm.jms.JMSMessage.setObjectProperty(JMSMessage.java:5419)
                              at org.jboss.ejb.plugins.jms.DLQHandler.makeWritable(DLQHandler.java:371)
                              at org.jboss.ejb.plugins.jms.DLQHandler.sendMessage(DLQHandler.java:274)
                              at org.jboss.ejb.plugins.jms.DLQHandler.handleRedeliveredMessage(DLQHandler.java:233)
                              at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1105)
                              at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)
                              at com.ibm.mq.jms.MQSession.run(MQSession.java:1136)
                              at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:182)
                              at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:732)
                              at java.lang.Thread.run(Thread.java:534)
                              2004-03-15 18:17:45,824 ERROR [org.jboss.ejb.plugins.jms.JMSContainerInvoker] Exception in JMSCI message listener
                              java.lang.NullPointerException
                              at org.jboss.ejb.plugins.jms.DLQHandler.sendMessage(DLQHandler.java:279)
                              at org.jboss.ejb.plugins.jms.DLQHandler.handleRedeliveredMessage(DLQHandler.java:233)
                              at org.jboss.ejb.plugins.jms.JMSContainerInvoker$MessageListenerImpl.onMessage(JMSContainerInvoker.java:1105)
                              at org.jboss.jms.asf.StdServerSession.onMessage(StdServerSession.java:256)
                              at com.ibm.mq.jms.MQSession.run(MQSession.java:1136)
                              at org.jboss.jms.asf.StdServerSession.run(StdServerSession.java:182)
                              at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:732)
                              at java.lang.Thread.run(Thread.java:534)

                              • 12. Re: DLQHandler and Websphere MQ (MQSeries)
                                hofmeister Newbie

                                Hi all,

                                we encounter the same problem.
                                I had a look at the DLQHandler sourcecode. There in the sendMessage-method it accesses the JMSDestination by invoking the messages's "getJMSDestination()". Then it tries to apply the "toString()" Method to that destination.
                                But when you send a message from a non-JMS client (as we do) that field is null, because of the MQSeries internal header-mapping.
                                I don't really know if we can call this a bug in JBoss. Because assuming we have a JMS-message is ok (and in a certain way we do have one). But it would be great to have a DLQHandler which does not discard a msg when it came from a c-client and an error processing it occured. I'm not quite sure if I should change the code at that point. It would be better if the people at jboss would do it.

                                Greets,

                                helge

                                • 13. Re: DLQHandler and Websphere MQ (MQSeries)
                                  Elias Ross Master


                                  I fixed the NPE problem in the CVS version of JBoss.