title: Getting NullPointerException from message listener container, while staring spring boot application
body: <p>I am getting following error with my Spring boot application:</p>
  <pre><code>Exception in thread &quot;custom-message_listener-container-2&quot; java.lang.NullPointerException
      at redis.clients.jedis.BinaryJedisPubSub.psubscribe(BinaryJedisPubSub.java:53)
      at org.springframework.data.redis.connection.jedis.JedisSubscription.doPsubscribe(JedisSubscription.java:59)
      at org.springframework.data.redis.connection.util.AbstractSubscription.pSubscribe(AbstractSubscription.java:159)
      at org.springframework.data.redis.listener.RedisMessageListenerContainer$SubscriptionTask$PatternSubscriptionTask.run(RedisMessageListenerContainer.java:707)
      at java.base/java.lang.Thread.run(Thread.java:829)
  </code></pre>
  <p>Redis pub/sub configuration for my application is as follows:</p>
  <pre><code>@Configuration
  public class RedisPubSubConfiguration {
  
    @Bean(&quot;custom-message_listener-container&quot;)
    public RedisMessageListenerContainer messageListenerContainer(RedisConnectionFactory
                                                                        connectionFactory,
                                                                  @Qualifier(&quot;topicAdapterPair&quot;)
                                                                      List&lt;Pair
                                                                          &lt;Topic,
                                                                              MessageListenerAdapter&gt;&gt;
                                                                           channelAdapterPairList) {
      RedisMessageListenerContainer container = new RedisMessageListenerContainer();
      for (Pair&lt;Topic, MessageListenerAdapter&gt; chanelAdapterPair : channelAdapterPairList) {
        container.addMessageListener(chanelAdapterPair.getValue(),
            chanelAdapterPair.getKey());
      }
      container.setConnectionFactory(connectionFactory);
      return container;
    }
  
    @Bean(&quot;redis-msg-listener-adptr&quot;)
    public MessageListenerAdapter ruleDBUpdateListenerAdapter(
        @Qualifier(&quot;message-listener&quot;)
            MessageListener listener) {
      return new MessageListenerAdapter(listener, REDIS_RECEIVER_METHOD_NAME);
    }
  
    @Bean(&quot;message-listener&quot;)
    public MessageListener listener(Manager manager) {
      return new Listener(manager);
    }
  
    @Bean(&quot;message-sender&quot;)
    public MessageSender ruleDBUpdateSender(RedisTemplate redisTemplate,
                                            @Value(&quot;${chnlTopicName}&quot;)
                                    String channelTopicName) {
      return new RefreshRuleEngineMessageSender(redisTemplate, channelTopicName);
    }
  
    @Bean
    @Qualifier(&quot;topicAdapterPair&quot;)
    public Pair&lt;Topic, MessageListenerAdapter&gt; getRuleEngineTopicListenerAdapterPair(
        @Value(&quot;${chnlTopicName}&quot;) String channelTopicName,
        @Qualifier(&quot;redis-msg-listener-adptr&quot;)
            MessageListenerAdapter messageListenerAdapter) {
      return Pair.of(new ChannelTopic(channelTopicName), messageListenerAdapter);
    }
  
    @Bean
    public KeyExpiredListener keyExpiredListener(
        @Qualifier(&quot;custom-message_listener-container&quot;)
        RedisMessageListenerContainer customMessageListenerContainer,
        KeyExpiryHandlerFactory keyExpiryHandlerFactory) {
      return new KeyExpiredListener(customMessageListenerContainer,
          keyExpiryHandlerFactory);
    }
  }
  </code></pre>
  <p>pom.xml is as follows:</p>
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.springframework.session&lt;/groupId&gt;
      &lt;artifactId&gt;spring-session-data-redis&lt;/artifactId&gt;
  &lt;/dependency&gt;
  
  &lt;dependency&gt;
      &lt;groupId&gt;redis.clients&lt;/groupId&gt;
      &lt;artifactId&gt;jedis&lt;/artifactId&gt;
  &lt;/dependency&gt;
  </code></pre>
  <p>Here jedis version is: 3.3.0 and spring-data-redis version is: 2.4.6</p>
  <p>I am not able to understand, how should I fix this.</p>