title: Spring Boot 2 Could not refresh JMS Connection after redeployment to Wildfly 10
body: <p>Was working fine with Spring but not with Spring Boot 2.</p>
  
  <p>After WAR redeployment to Wildfly 10 JMS stops working with error:</p>
  
  <p>ERROR [org.springframework.jms.listener.DefaultMessageListenerContainer] (DefaultMessageListenerContainer-1) Could not refresh JMS Connection for destination 'wfQueue' - retrying using FixedBackOff{interval=5000, currentAttempts=44, maxAttempts=unlimited}. Cause: Failed to create session factory; nested exception is java.lang.IllegalStateException: Server locator is closed (maybe it was garbage collected)</p>
  
  <p>Restart fixes the problem but downtime is undesirable.</p>
  
  <p>Dependencies: </p>
  
  <pre><code>        &lt;dependency&gt;
          &lt;groupId&gt;com.oracle&lt;/groupId&gt;
          &lt;artifactId&gt;ojdbc7&lt;/artifactId&gt;
          &lt;version&gt;12.1.0.2.0&lt;/version&gt;
      &lt;/dependency&gt;
  
  
  
  
  
      &lt;!-- Spring --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
                &lt;artifactId&gt;spring-boot-starter-tomcat&lt;/artifactId&gt;
              &lt;/exclusion&gt;
            &lt;/exclusions&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-data-jpa&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
         &lt;groupId&gt;org.hibernate&lt;/groupId&gt;
         &lt;artifactId&gt;hibernate-entitymanager&lt;/artifactId&gt;
         &lt;scope&gt;runtime&lt;/scope&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-autoconfigure&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-activemq&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
  
  
      &lt;!-- Appache commons --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
          &lt;artifactId&gt;commons-lang3&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;commons-io&lt;/groupId&gt;
          &lt;artifactId&gt;commons-io&lt;/artifactId&gt;
          &lt;version&gt;2.5&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;commons-fileupload&lt;/groupId&gt;
          &lt;artifactId&gt;commons-fileupload&lt;/artifactId&gt;
          &lt;version&gt;1.2&lt;/version&gt;
      &lt;/dependency&gt;
  
  
      &lt;!-- POI --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.poi&lt;/groupId&gt;
          &lt;artifactId&gt;poi-ooxml&lt;/artifactId&gt;
          &lt;version&gt;3.10-FINAL&lt;/version&gt;           
      &lt;/dependency&gt;
  
      &lt;!-- For documents at the stmt screene --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.mongodb&lt;/groupId&gt;
          &lt;artifactId&gt;mongo-java-driver&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
  
  
      &lt;!-- Gson --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.google.code.gson&lt;/groupId&gt;
          &lt;artifactId&gt;gson&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Mail --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.mail&lt;/groupId&gt;
          &lt;artifactId&gt;mail&lt;/artifactId&gt;
          &lt;version&gt;1.4.7&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- xstream --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;com.thoughtworks.xstream&lt;/groupId&gt;
          &lt;artifactId&gt;xstream&lt;/artifactId&gt;
          &lt;version&gt;1.4.9&lt;/version&gt;
      &lt;/dependency&gt;
  
  
      &lt;!--############################# JSP RELATED ####################### --&gt;
      &lt;!-- JSP Dependency --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet.jsp&lt;/groupId&gt;
          &lt;artifactId&gt;javax.servlet.jsp-api&lt;/artifactId&gt;
          &lt;version&gt;2.3.1&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- Servlet Dependency --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet&lt;/groupId&gt;
          &lt;artifactId&gt;javax.servlet-api&lt;/artifactId&gt;
      &lt;/dependency&gt;
  
  
      &lt;dependency&gt;
          &lt;groupId&gt;javax.servlet.jsp.jstl&lt;/groupId&gt;
          &lt;artifactId&gt;javax.servlet.jsp.jstl-api&lt;/artifactId&gt;
          &lt;version&gt;1.2.1&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;taglibs&lt;/groupId&gt;
          &lt;artifactId&gt;standard&lt;/artifactId&gt;
          &lt;version&gt;1.1.2&lt;/version&gt;
      &lt;/dependency&gt;
  
  
  
  
  
      &lt;dependency&gt;
          &lt;groupId&gt;displaytag&lt;/groupId&gt;
          &lt;artifactId&gt;displaytag&lt;/artifactId&gt;
          &lt;version&gt;1.2&lt;/version&gt;
          &lt;exclusions&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;log4j&lt;/groupId&gt;
                  &lt;artifactId&gt;log4j&lt;/artifactId&gt;
              &lt;/exclusion&gt;
              &lt;exclusion&gt;
                  &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
                  &lt;artifactId&gt;slf4j-log4j12&lt;/artifactId&gt;
              &lt;/exclusion&gt;
          &lt;/exclusions&gt;           
      &lt;/dependency&gt;
  
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.apache.taglibs&lt;/groupId&gt;
          &lt;artifactId&gt;taglibs-standard-impl&lt;/artifactId&gt;
          &lt;version&gt;1.2.5&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;!-- EJB --&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss&lt;/groupId&gt;
          &lt;artifactId&gt;jboss-remote-naming&lt;/artifactId&gt;
          &lt;version&gt;2.0.4.Final&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.xnio&lt;/groupId&gt;
          &lt;artifactId&gt;xnio-nio&lt;/artifactId&gt;
          &lt;version&gt;3.4.2.Final&lt;/version&gt;
      &lt;/dependency&gt;
  
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.jboss.marshalling&lt;/groupId&gt;
          &lt;artifactId&gt;jboss-marshalling&lt;/artifactId&gt;
          &lt;version&gt;1.4.11.Final&lt;/version&gt;
      &lt;/dependency&gt;
  
      &lt;dependency&gt;
          &lt;groupId&gt;org.wildfly&lt;/groupId&gt;
          &lt;artifactId&gt;wildfly-ejb-client-bom&lt;/artifactId&gt;
          &lt;version&gt;10.0.0.Final&lt;/version&gt;
          &lt;type&gt;pom&lt;/type&gt;
      &lt;/dependency&gt;
  </code></pre>