zoukankan      html  css  js  c++  java
  • 常见的问题系列---【使用redis取值的时候,java.lang.RuntimeException: Reading from a byte array threw an IOException (should never happen).】

    问题:使用redis取值的时候,报这个异常java.lang.RuntimeException: Reading from a byte array threw an IOException (should never happen)。

     1.取的时候,反序列化会有问题,我遇见一个问题:redis中有key值,取一个存到数据库中,通过redisTemplate去取的时候,取不到,把数据库中的key值,换一个key就能取到。

    2.取到了,但是反序列化的对象和存的值对不上,可能有的字段乱码。

    解决方案:

    再往redis存的时候,统一用json格式化成String,再存入redis,取的时候使用jsonObject再转成对象使用。

    愿你走出半生,归来仍是少年!
  • 相关阅读:
    MM and Desinger
    db subsequent and synchronization(transfer)
    Thread concepts
    Threads concepts
    lucene article
    primary key
    lucene
    page procedure
    connection pool
    page procedures
  • 原文地址:https://www.cnblogs.com/hujunwei/p/15479807.html
Copyright © 2011-2022 走看看