Announcement Announcement Module
No announcement yet.
DefaultJmsHeaderMapper error Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • DefaultJmsHeaderMapper error

    I am trying to read message from a WMQ queue using jms-source and its giving me following exception :

    18:00:21,141 WARN  [MessagePublishingErrorHandler] failure occurred in messaging task
    org.springframework.integration.message.MessagingException: failed to map from MessageHeader
    	at org.springframework.integration.adapter.jms.DefaultJmsHeaderMapper.mapFromMessageHeader(
    	at org.springframework.integration.adapter.jms.DefaultJmsHeaderMapper.mapFromMessageHeader(
    	at org.springframework.integration.adapter.jms.HeaderMappingMessageConverter.toMessage(
    	at org.springframework.jms.core.JmsTemplate$6.createMessage(
    	at org.springframework.jms.core.JmsTemplate.doSend(
    	at org.springframework.jms.core.JmsTemplate$4.doInJms(
    	at org.springframework.jms.core.JmsTemplate.execute(
    	at org.springframework.jms.core.JmsTemplate.send(
    	at org.springframework.jms.core.JmsTemplate.convertAndSend(
    	at org.springframework.jms.core.JmsTemplate.convertAndSend(
    	at org.springframework.integration.adapter.jms.JmsTargetAdapter.send(
    	at org.springframework.integration.endpoint.TargetEndpoint.send(
    	at org.springframework.integration.dispatcher.SimpleDispatcher.dispatch(
    	at org.springframework.integration.scheduling.SimpleMessagingTaskScheduler$
    	at java.util.concurrent.Executors$
    	at java.util.concurrent.FutureTask$Sync.innerRunAndReset(
    	at java.util.concurrent.FutureTask.runAndReset(
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(
    	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(
    	at java.util.concurrent.ScheduledThreadPoolExecutor$
    	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
    	at java.util.concurrent.ThreadPoolExecutor$
    Caused by: javax.jms.MessageFormatException: MQJMS1058: Invalid message property name: JMSXDeliveryCount
    	at org.springframework.integration.adapter.jms.DefaultJmsHeaderMapper.mapFromMessageHeader(
    	... 23 more
    What could be the issue ? and should it be throwing an exception in the case that it is not able to map the JMS headers ?

  • #2
    The property value is being retrieved from the inbound JMS Message and stored in the Spring Integration MessageHeader. Then on your response, it is automatically mapping that value back to the outbound JMS Message. Unfortunately, that particular value is intended for reading only.

    Please raise an issue in JIRA for this.

    In the short term, you could set your own MessageHeaderMapper implementation. That is not available currently in the namespace support, but you can create the source as a <bean/> element. The other short term option is to remove the attribute value from the header in a MessageHandler.

    I agree that the Exception being rethrown in this case might be too extreme, and I will make a change for that in particular ASAP.



    • #3
      I went ahead and created the following two issues in JIRA:


      • #4
        I have just committed a change to prevent such exceptions from producing a fatal condition. This includes not only JMSExceptions but also others that may occur while trying to set JMS properties (e.g. IllegalArgumentException).

        If you check out the latest version from SVN or grab tonight's nightly snapshot (when available), the exception will simply be logged at WARN level instead.



        • #5
          Thanks Mark..that did work ..but have you changed the schema for the endpoint to have 'handler' instead of 'handler-ref' now ?


          • #6
            Yes, the <endpoint/> element now takes 'handler' instead of 'handler-ref'. Also, the <handler/> subelement has been removed.

            There are actually some rather significant changes in the works for the namespace, so I apologize in advance, but it's important that we get the changes out there while still in the milestone release phase.

            Just as a quick description, instead of just <endpoint/>, we will have <source-endpoint/> <target-endpoint/> and <handler-endpoint/>. Other attribute names will very likely be changing as well (e.g. "input-channel" -> "input" and "handler-method" -> "method").

            In most cases, it should require just a find+replace.