title: Porting a standalone JMS application to a web/app server
body: <p><strong>The Background :</strong></p>
  
  <p>We have a JMS (point to point) based standalone application. We currently start the JMS listener in a separate JVM instance through a Java main program and we publish requests to this listener from another JVM instance through another Java main program. </p>
  
  <p><strong>The requirement :</strong></p>
  
  <p>We want to port only the JMS listener onto a web/application server as a war/ear. We want to start the JMS listener when the war/ear is deployed by the container. </p>
  
  <p><strong>The questions :</strong></p>
  
  <ol>
  <li><p>Would it be a good idea to write a Servlet and configure  <code>&lt;load-on-startup&gt;</code> as true. We can then start the JMS listener in the init method of the servlet. What are the pros and cons of doing this? </p></li>
  <li><p>Is there a better option than point 1 to start the JMS listener on application startup?</p></li>
  <li><p>We are using Spring and Spring JMS in our application. Can we simply move our spring context files to META-INF or is there any additional configuration changes required for the spring context files to be visible to the web app. </p></li>
  </ol>
  
  <p>Note that for constraints beyond our control, we need to port the JMS listener to a web-app. I am not looking to know whether porting this is a good idea or not but rather interested in knowing how to do this. </p>