Re: Exception : java.lang.ClassCastException: [B cannot be cast to java.util.List Multithreading environnement

1,448 views
Skip to first unread message

Jonathan Leibiusky

unread,
Feb 6, 2014, 10:22:56 AM2/6/14
to jedis...@googlegroups.com
Does it happen all the time or sometimes?
Also, if I run this code on an empty redis instance I will get that error?


On Thu, Feb 6, 2014 at 5:33 AM, Wahyd Mnémoi <mnemoi...@gmail.com> wrote:
Hi,
First, (i'm sorry for my poor English in advance, i'm not very fluent), so i'm getting a classcast exception, here the code : 

public static Set<String> findEntries(String nameClass, String fieldName, Object fieldValue) {
        Jedis j = null;
        try {
            j = pool.getResource();
        } catch (Exception e) {
            LOGGER.error(e.getMessage(), e);
        }
        try {
            String key = nameClass+ "<" + fieldName + ">";
            double minmaxScore = calculateScore(fieldValue);
            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);
        }
}
Here the exception : 

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)
[..]

I have implemented a webservice which call this method with a asynchronous client and it throws this exception. Any ideas ? I use Redis 2.6 and Jedis 2.2.1

--
You received this message because you are subscribed to the Google Groups "Jedis" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jedis_redis...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Wahyd Mnémoi

unread,
Feb 6, 2014, 11:05:28 AM2/6/14
to jedis...@googlegroups.com
it often happen during the load test. So i don't think you get that error on an empty redis instance.
I thought it could be due to the implementation of my JedisPool or the way i release jedis instance, so here is the code
of the instanciation of my JedisPool : 

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

임정택

unread,
Feb 6, 2014, 11:14:24 AM2/6/14
to jedis...@googlegroups.com
Hello, Wahyd.

Could you please reproduce this issue again with latest Jedis release, which version is 2.3.1?

Jedis has been resolved several issues after 2.2.1, I guess some issues may related to your problem.

For example, if you're using Jedis 2.2.1 and maybe Redis disconnect client while Jedis is getting bulk response, Jedis could not throw JedisConnectionException and makes strange problem.

Thank you for reporting!

2014년 2월 7일 금요일 오전 1시 5분 28초 UTC+9, Wahyd Mnémoi 님의 말:
Reply all
Reply to author
Forward
0 new messages