title: Spring Message Driven Channel Adapter along with JMS outbound Gateway
body: <p>I have a <strong>jms:message-driven-channel-adapter</strong> and in its downstream I have a <strong>jms:outbound-gateway</strong>.
  The problem occurs whenever I get message in channel adapter in one thread like below</p>
  
  <p>[org.springframework.jms.listener.DefaultMessageListenerContainer**#1-4**] and gateway response in another therad like below:</p>
  
  <p>[org.springframework.jms.listener.DefaultMessageListenerContainer**#3-5**].</p>
  
  <p>I get a weird exception: </p>
  
  <p>org.springframework.integration.MessageRejectedException: Message was rejected due to XML Validation errors; nested exception is org.springframework.integration.xml.AggregatedXmlMessageValidationException: Multiple causes:
      cvc-elt.1: Cannot find the declaration of element 'NS1:FindPermitsByPersonNoRes'.</p>
  
  <p>But whenever both thread ids are identical, I do not get any exception.</p>
  
  <p>Below is my config of gateway:</p>
  
  <pre><code>    &lt;int:header-enricher&gt;
          &lt;int:header name="jms_replyTo" ref="outboundQueue" overwrite="true"/&gt;
          &lt;int:header name="jms_type" type="java.lang.String" value="1" overwrite="true" /&gt;
          &lt;int:header name="jms_correlationId" type="java.lang.String" expression="T(java.util.UUID).randomUUID().toString()" overwrite="true" /&gt;
      &lt;/int:header-enricher&gt;
  
      &lt;jms:outbound-gateway 
          request-channel="gateway_request_channel"
          request-destination="inboundQueue"
          reply-destination="outboundQueue" 
          correlation-key="JMSCorrelationID"
          connection-factory="brokerConnectionFactory"&gt;
  
          &lt;jms:reply-listener/&gt;
  
      &lt;/jms:outbound-gateway&gt;
  </code></pre>