1 Reply Latest reply on Mar 19, 2003 4:45 PM by Adrian Brock

    SpyJMSException(linked ex: NullPointerException) when MDB se

    Guo Jianyu Newbie

      Hi,
      Our system got a SpyJMSException when one of the MDB, in its onMessage() method, was trying to send a message to the same queue where it was picking its messages from.

      We use quite a number of MDBs. This particular MDB is driven by a queue. It picks up messages from the queue, processes them, generate new messages and send to the same queue. The above-mentioned problem doesn't occur everytime, but whenever it does, it always happens in the MDB's onMessage(), when it is trying to send the new message to the same queue. The load of the system is not very high, though.

      I'm using Jboss 3.0.0 alpha, windows 2000, jdk1.3.0.
      Messages are sent in Persistent mode, queue session is not transacted.

      The log is here:
      org.jboss.mq.SpyJMSException: Cannot send a message to the JMS server
      at org.jboss.mq.Connection.sendToServer(Connection.java:973)
      at org.jboss.mq.SpySession.sendMessage(SpySession.java:400)
      at org.jboss.mq.SpyQueueSender.send(SpyQueueSender.java:103)
      at org.jboss.mq.SpyQueueSender.send(SpyQueueSender.java:64)
      at com.grid.pdip.jms.JMSSender.sendMessageToQueue(JMSSender.java:101)
      at com.grid.pdip.app.ejb.GWActivityManagerBean.createActivity(GWActivityManagerBean.java:213)
      ...
      at com.grid.pdip.app.ejb.GWActivityMDBean.onMessage(GWActivityMDBean.java:331)
      ...
      linked exception is :
      java.lang.NullPointerException

      at org.jboss.mq.AcknowledgementRequest.hashCode(AcknowledgementRequest.java:41)
      at java.util.HashMap.put(Unknown source)
      at org.jboss.mq.server.BasicQueue.setupMessageAcknowledgement(BasicQueue.java:300)
      at org.jboss.mq.server.BasicQueue.queueMessageForSending(BasicQueue.java:305)
      at org.jboss.mq.server.BasicQueue.internalAddMessage(BasicQueue.java:348)
      at org.jboss.mq.server.BasicQueue.access$000(BasicQueue.java:37)
      at org.jboss.mq.server.BasicQueue$1$AddMessagePostCommitTask.run(BasicQueue.java:281)
      at org.jboss.mq.pm.TxManager.addPostCommitTask(TxManager.java:121)
      at org.jboss.mq.server.BasicQueue.addMessage(BasicQueue.java:287)
      at org.jboss.mq.server.PersistentQueue.addMessage(PersistentQueue.java:49)
      at org.jboss.mq.server.JMSQueue.addMessage(JMSQueue.java:107)
      at org.jboss.mq.server.JMSServer.addMessage(JMSServer.java:403)
      at org.jboss.mq.server.JMSServer.addMessage(JMSServer.java:381)
      at org.jboss.mq.il.jvm.JVMServerIL.addMessage(JVMServerIL.java:135)
      at org.jboss.mq.Connection.sendToServer(Connection.java:968)
      at org.jboss.mq.SpySession.sendMessage(SpySession.java:400)
      at org.jboss.mq.SpyQueueSender.send(SpyQueueSender.java:103)
      at org.jboss.mq.SpyQueueSender.send(SpyQueueSender.java:64)
      at com.grid.pdip.jms.JMSSender.sendMessageToQueue(JMSSender.java:101)
      ...

      I looked into the source code and concluded the NullPointerException was thrown because the message's messageID, which was generated by JbossMQ earlier on, seems to have become NULL when JbossMQ was trying to put the message into the HashMap "unacknowledgedMessages".

      Any idea? Thanks.