Cannot read Redis bulk reply as a Long

java.lang.ClassCastException
Javadoc
Thrown to indicate that the code has attempted to cast an object to a subclass of which it is not an instance. For example, the following code generates a ClassCastException:
    Object x = new Integer(0);
    System.out.println((String)x);
@author unascribed @since JDK1.0
at redis.clients.jedis.Connection.getIntegerReply
Source

Typical Exception Messages

  1. [B cannot be cast to java.lang.Long
  2. java.util.ArrayList cannot be cast to java.lang.Long

Solutions

  1. zsamboki, 1 month ago

    You should not use the client from multiple threads at the same time. Check out: https://github.com/xetorthio/jedis/wiki/Getting-started#using-jedis-in-a-multithreaded-environment

We have seen this error pattern in the following webpages (14)

  1. ruanjfvia GitHub1 year ago
    [B cannot be cast to java.lang.Long
  2. zhenguangvia GitHub1 year ago
    java.util.ArrayList cannot be cast to java.lang.Long
  3. inponomarevvia GitHub1 year ago
    [B cannot be cast to java.lang.Long
  4. Bam4dvia GitHub1 year ago
    java.util.ArrayList cannot be cast to java.lang.Long
  5. Unknown authorvia techforumnetwork.com2 years ago
    java.util.ArrayList cannot be cast to java.lang.Long
  6. SBoylevia Google Groups2 years ago
    [B cannot be cast to java.lang.Long
  7. Unknown authorvia spring.io2 years ago
    java.util.ArrayList cannot be cast to java.lang.Long
  8. m8r-ubnc5gvia GitHub2 years ago
    [B cannot be cast to java.lang.Long
  9. Unknown authorvia com.cn2 years ago
    java.util.ArrayList cannot be cast to java.lang.Long