java.lang.ClassCastException JedisPool Multithreading

65 views
Skip to first unread message

Wahyd Mnémoi

unread,
Feb 6, 2014, 6:02:25 AM2/6/14
to jedis...@googlegroups.com

Hi,

First, sorry for my poor english, i'm not very fluent. I'm getting an class clast exception. I thought it could be due to the implementation of my JedisPool or the way i release jedis instance, so here the code

for the instanciation of my JedisPool : 

    static {
        JedisPoolConfig config = new JedisPoolConfig();
        config.setTestOnBorrow(true);
        pool = new JedisPool(config, "localhost");
    }


for the method where it throws the exception 

    public static Set<String> testgetEntries() {
        Jedis j = null;
        try {
            j = pool.getResource();
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
        try {
            String key =" something"
            double minmaxScore = 23
            Set<String> result = j.zrangeByScore(key, minmaxScore, minmaxScore);
            return result;
        } catch (JedisConnectionException e) {
            LOGGER.error(e.getMessage(), e);
            if (j != null) {
                pool.returnBrokenResource(j);
                j = null;
            }
        } finally {
            if(j != null)
                pool.returnResource(j);
        }
        return new HashSet<String>();
    }



- [B cannot be cast to java.util.List
java.lang.ClassCastException: [B cannot be cast to java.util.List
at redis.clients.jedis.Connection.getBinaryMultiBulkReply(Connection.java:202)
at redis.clients.jedis.Connection.getMultiBulkReply(Connection.java:195)
at redis.clients.jedis.Jedis.zrangeByScore(Jedis.java:2023)
[..]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)

Any ideas on where it is going wrong? 

Regards,
Wahyd.
Reply all
Reply to author
Forward
0 new messages