Error serializing object:序列化对象时出错

序列化对象时出错 :Error serializing object.

Error serializing object.  Cause: java.io.NotSerializableException: cn.yudie.blog.model.doo.User

很简单的一个错误, mybatis开启二级缓存后,在sqlsession关闭时,一级缓存会被刷新到二级缓存。 如果实体类没有实现序列化接口serializing 就会出现这个异常。

事务同步提交
[http-nio-80-exec-5] DEBUG org.mybatis.spring.SqlSessionUtils : Transaction synchronization committing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@329d1e81]
事务同步 注销
[http-nio-80-exec-5] DEBUG org.mybatis.spring.SqlSessionUtils : Transaction synchronization deregistering SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@329d1e81]
事务同步 关闭
[http-nio-80-exec-5] DEBUG org.mybatis.spring.SqlSessionUtils : Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@329d1e81]
错误!
[http-nio-80-exec-5] ERROR o.s.t.s.TransactionSynchronizationUtils : TransactionSynchronization.beforeCompletion threw exception
org.apache.ibatis.cache.CacheException: Error serializing object.  Cause: java.io.NotSerializableException: cn.yudie.blog.model.doo.User
    at org.apache.ibatis.cache.decorators.SerializedCache.serialize(SerializedCache.java:102)
    at org.apache.ibatis.cache.decorators.SerializedCache.putObject(SerializedCache.java:56)
    at org.apache.ibatis.cache.decorators.LoggingCache.putObject(LoggingCache.java:51)
    at org.apache.ibatis.cache.decorators.SynchronizedCache.putObject(SynchronizedCache.java:45)

猜你喜欢

转载自www.cnblogs.com/songyanrumo/p/12373129.html