Jedis newspaper classcastexception: [B cannot be cast to XXX

Source: Internet
Author: User

In the code for a value of a long type key to perform the Incrby operation, has been normal, burst a case of exception:

caused by:java.lang.ClassCastException: [B cannot is cast to Java.lang.Long at Redis.clients.jedis.Connection.get Integerreply (connection.java:210) at Redis.clients.jedis.Jedis.incrBy (jedis.java:556) at Com.xxx.xxxxxClie Nt.incrby (singlejedisclientimpl.java:119) ... Common frames omitted

Where Com.xxx.xxxxxClient.incrBy is a encapsulation and management of the Jedis client. It's supposed to be xxxxxclient there's a problem here. Or, the Jedis itself has a problem with the thread pool management.

----------------The following is online information, transferred from Http://mengkang.net/443.html---------------------------------------

caused by: java.lang.classcastexception: [b cannot be cast to  java.util.list        at  Redis.clients.jedis.Connection.getBinaryMultiBulkReply (connection.java:218)         at redis.clients.jedis.connection.getmultibulkreply (connection.java:211)          at redis.clients.jedis.jedis.lrange (jedis.java:862)          at me.topit.site.util.redis.cacheclientbase.lrange (CacheClientBase.java:516)       at me.topit.site.cache.tagcache.get (TagCache.java:37)        at me.topit.site.model.tags.getuserselectedtags (Tags.java:141)        at me.topit.site.service.feedservice.gettype (feedservice.java:41) or caused by:  java.lang.classcastexception: java.util.arraylist cannot be cast to [b      at  Redis.clients.jedis.Connection.getBinaryBulkReply (connection.java:201)       at  redis.clients.jedis.connection.getbulkreply (connection.java:190)         at redis.clients.jedis.jedis.hget (jedis.java:601)        at  Me.topit.site.util.redis.CacheClientBase.hget (cacheclientbase.java:51)       at  me.topit.site.cache.accountcache.getauth (accountcache.java:30)       at  me.topit.site.model.account.getauth (account.java:137)         at  me.topit.site.service.accountservice.logincheck (accountservice.java:112)        at me.topit.site.service.baseservice.islogin (baseservice.java:87)         at me.topit.site.service.pushservice.bind (Pushservice. java:53) 

I discovered it because I made the thread pool of the Redis connection, which was always a static variable declared in the parent class, and the local tune was used directly. It was not released after use. So every time the project runs, it's a few hours to get to the super slow. The final discovery is due to the use of a connection. It is now initialized for each use, and then released each time it is exhausted.

------------------------------------------------------------------------------------------------------------

This may be the reason mentioned by the author. Not confirmed.

Jedis newspaper classcastexception: [B cannot be cast to XXX

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.