简体   繁体   English

具有Redisson的Tomcat会话管理器

[英]Tomcat session manager with redisson

Trying to configure my JavaEE web project with Redisson. 尝试使用Redisson配置我的JavaEE Web项目。

  1. Setup Redis in Docker container and it works fine. 在Docker容器中安装Redis,它可以正常工作。

  2. Went through https://github.com/redisson/redisson/tree/master/redisson-tomcat to configure my tomcat. 通过https://github.com/redisson/redisson/tree/master/redisson-tomcat来配置我的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"] java.lang.IllegalArgumentException:com.fasterxml.jackson.databind.JsonMappingException:无限递归(StackOverflowError)(通过参考链: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. 我从那里读到的内容发现,这与使用jackson序列化具有双向关系的Java对象有关。 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. 我对redisson相对较新,并且不知道还需要做些什么才能在我现有的javaEE项目中使用它作为会话管理器。 We are trying to move from traditional tomcat session manager to redisson based tomcat session manager. 我们正在尝试从传统的tomcat会话管理器过渡到基于redisson的tomcat会话管理器。 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. 我开始使用@JsonIgnore删除双向关系,但是有太多双向关系,我觉得浪费时间使用杰克逊进行序列化。 So, I changed the codec from jackson to JDK Serialization codec and after few issues the project worked fine. 因此,我将编解码器从杰克逊更改为JDK序列化编解码器,并且在出现几个问题之后,该项目运行良好。

In redisson.yml file add/change below line: 在redisson.yml文件中,在以下行添加/更改:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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