title: Could not refresh JMS Connection for destination Cause: Authentication failed
body: <p>When I'm trying to listen through command line it works fine, but using Spring Boot it throws below error:</p>
  <pre><code>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: authentication failed
  javax.jms.JMSSecurityException: authentication failed
  </code></pre>
  <p>This is my app class</p>
  <pre class="lang-java prettyprint-override"><code>@SpringBootApplication(scanBasePackages = {&quot;com.source.lbm&quot;})
  public class EMSConsumerApp {
  
      public static main(String[] args){
          run(EMSConsumerApp.class, args);         
      }
  }
  </code></pre>
  <p>This class configures definitions for JMS consumer</p>
  <pre class="lang-java prettyprint-override"><code>@EnableJMS
  @EnableTransactionManagement
  public abstract class SubscriberConfiguration {
      private final String url;
      private final String clientId;
      private final String username;
      private final String password;
  
      public SubscriberConfiguration(String url, String clientId, String username, String password) {
          this.url = url;
          this.clientId = clientId;
          this.username = username;
          this.password = password;
      }
      
      @Bean
      public DefaultJmsListenerContainerFactory jsmListenerContainerFactory(ConnectionFactory connectionFactory) {
          DefaultJmsListenerContainerFactory containerFactory = new DefaultJmsListenerContainerFactory();
          containerFactory.setconnectionFactory(connectionFactory);
          containerFactory.setPubSubDomain(true);
          containerFactory.setSubscriptionDurable(true);
          containerFactory.setSessionTransacted(true);
          containerFactory.setAutoStartup(true);
      
          return containerFactory;
      }
          
      @Bean
      public ConnectionFactory jmsConnectionFactory() throws JMSException{
          TibjmsXATopicConnectionFactory connectionFactory = new TibjmsXATopicConnectionFactory();
          connectionFactory.setServerUrl(url);
          connectionFactory.setClientId(clientId);
          connectionFactory.setUserName(username);
          connectionFactory.setUserPassword(password);
          return connectionFactory;        
      }
          
  }
  </code></pre>
  <p>This sets configs for a subscriber</p>
  <pre class="lang-java prettyprint-override"><code>@Configuration
  public class LbmSubConfiguration extends SubscriberConfiguration {
  
      public LbmSubConfiguration(
          @Value(&quot;${ems.lbm.sub.url}&quot;) String emsUrl;
          @Value(&quot;${ems.lbm.sub.clientId}&quot;) String subClientId;
          @Value(&quot;${ems.lbm.sub.username}&quot;) String subUsername;
          @Value(&quot;${ems.lbm.sub.password}&quot;) String subPasword) {
      super(emsUrl,subClientId,subUsername,subPasword);
      }
  }
  </code></pre>
  <p>This class listenes to ems and consumes messages</p>
  <pre class="lang-java prettyprint-override"><code>@Component
  public class LbmEventConsumer {
      @JmsListener(destination = &quot;${ems.lbm.sub.destination}&quot;, containerFactory = &quot;jmsListenerContainerFactory&quot;)
      public void onMessage(BytesMessage message){
        System.out.println(&quot;Message &quot; + message);
      }
  }
  </code></pre>
  <p>Since these credentials work fine on command line there shouldn't be an issue with credentials. Possibly it's because I'm missing some configs (not sure though). Can you please help me figure out what's wrong with this?</p>