title: How to specify custom JMS Message Listener in Spring Xml
body: <p>I am new to JMS and had a requirement to batch requests for a listener to handle. Link: <a href="http://sleeplessinslc.blogspot.in/2010/04/batchmessagelistenercontainer-using.html" rel="nofollow">http://sleeplessinslc.blogspot.in/2010/04/batchmessagelistenercontainer-using.html</a> gives a good solution. I am stuck in implementing the same. Instead of using the default container, I overwrote the container-class to use this new class:</p>
  
  <pre><code>&lt;jms:listener-container container-class="org.bsnyder.spring.jms.listener.BatchMessageListenerContainer"
         acknowledge="transacted"&gt;
      &lt;jms:listener destination="CHANDRA.BATCHTEST" ref="messageListener" /&gt;
  &lt;/jms:listener-container&gt;
  
  &lt;bean id="messageListener" class="org.bsnyder.spring.jms.listener.BatchMessageListener" /&gt;
  </code></pre>
  
  <p>Here the BatchMessageListener is extending SessionAwareBatchMessageListener as mentioned in the blog.</p>
  
  <p>Error I get is: </p>
  
  <pre><code>[ERROR] PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'messageListener' threw exception; 
  nested exception is java.lang.IllegalArgumentException: Message listener needs to be of type [org.bsnyder.spring.jms.listener.SessionAwareBatchMessageListener]: 
  Failed properties: Property 'messageListener' threw exception; nested exception is java.lang.IllegalArgumentException: Message listener needs to be of type [org.bsnyder.spring.jms.listener.SessionAwareBatchMessageListener]
  </code></pre>
  
  <p>Should I change the container-type (which is "default" by default)? <a href="http://docs.spring.io/spring/docs/3.1.x/spring-framework-reference/html/jms.html" rel="nofollow">http://docs.spring.io/spring/docs/3.1.x/spring-framework-reference/html/jms.html</a> doesn't contain details on how to set this. </p>