简体   繁体   中英

Tomcat session manager with redisson

Trying to configure my JavaEE web project with Redisson.

  1. Setup Redis in Docker container and it works fine.

  2. Went through https://github.com/redisson/redisson/tree/master/redisson-tomcat to configure my tomcat.

When i am trying to run the project it throws below error:

java.lang.IllegalArgumentException: com.fasterxml.jackson.databind.JsonMappingException: Infinite recursion (StackOverflowError) (through reference chain: java.util.LoaderReference["cacheKey"]->java.util.CacheKey["loaderRef"]

I found out by reading from here and there that its something to do with using jackson to serialize Java objects having Bidirectional-Relationships. But the project is so huge and there are so many objects being serialized that its difficult to pin pint from where the issue might come.

I am relatively new to redisson and don't know what else is needed to be done to use it in my existing javaEE project as session manager. We are trying to move from traditional tomcat session manager to redisson based tomcat session manager. Any help will be appreciated.

I started removing the Bidirectional-Relationships by using @JsonIgnore but there were so many Bidirectional-Relationships that i felt wasting my time using jackson for serialization. So, I changed the codec from jackson to JDK Serialization codec and after few issues the project worked fine.

In redisson.yml file add/change below line:

codec: !<org.redisson.codec.SerializationCodec> {}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM