0

Getting the following exception after adding Redisson Session manager to Tomcat . Same as issue : java.io.NotSerializableException: org.mybatis.spring.SqlSessionTemplate . Any suggestion to solve the issue would be helpful . Thank you .

    java.lang.IllegalArgumentException: java.io.NotSerializableException: org.mybatis.spring.SqlSessionTemplate
        at org.redisson.command.CommandAsyncService.encodeMapValue(CommandAsyncService.java:717)
        at org.redisson.RedissonObject.encodeMapValue(RedissonObject.java:310)
        at org.redisson.RedissonMap.fastPutOperationAsync(RedissonMap.java:1411)
        at org.redisson.RedissonMap.fastPutAsync(RedissonMap.java:1401)
        at org.redisson.RedissonMap.fastPut(RedissonMap.java:1416)
        at org.redisson.tomcat.RedissonSession.fastPut(RedissonSession.java:257)
        at org.redisson.tomcat.RedissonSession.setAttribute(RedissonSession.java:344)
        at org.apache.catalina.session.StandardSession.setAttribute(StandardSession.java:1404)
    .....
    
Caused by:java.io.NotSerializableException: org.mybatis.spring.SqlSessionTemplate
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
            at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
            at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
            at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
            at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
            at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
Bala
  • 21
  • 3
  • Does this answer your question? [java.io.NotSerializableException: org.mybatis.spring.SqlSessionTemplate](https://stackoverflow.com/questions/44398807/java-io-notserializableexception-org-mybatis-spring-sqlsessiontemplate) – Piotr P. Karwasz Sep 13 '21 at 17:04
  • I believe your question is an exact duplicate of the one you cite (and I voted accordingly). Session attributes and the objects they reference **should** be serializable (so that sessions can be stored). In your case they **must** be serializable. The real question is: why the service class `SqlSessionTemplate` ends up as session attribute? You need to add the **complete** stack trace to answer it. – Piotr P. Karwasz Sep 13 '21 at 17:11

0 Answers0