简体   繁体   English

在 WildFly 18 上使用 Spring Session 和 HazelCast IMDG 进行会话复制和集群

[英]Session Replication and clustering using Spring Session and HazelCast IMDG on WildFly 18

As per the requirement, I have to make the WebApp sessions to be clustred on WildFly 18.根据要求,我必须在 WildFly 18 上创建 WebApp 会话。

I'm using Spring session to manage the clustering and filtering along with Spring Security.我正在使用Spring 会话与 Spring Security 一起管理集群和过滤。 The WebApp is using JSF 2.3 as fronted, and I'm using HazelCast to replicate and store the session. WebApp 使用JSF 2.3作为前端,我使用HazelCast复制和存储会话。

The problem is, when I try to run my application on WildFly, once logged in, if I try to refresh the page or navigate to other page I'm getting logged out instantly.问题是,当我尝试在 WildFly 上运行我的应用程序时,一旦登录,如果我尝试刷新页面或导航到其他页面,我会立即注销。 The same app is working fine on Tomcat, hence there must be something going on with WildFly configuration.同一个应用程序在 Tomcat 上运行良好,因此 WildFly 配置肯定有问题。

What I have done till now is:到目前为止我所做的是:

  • I'm using standalone.xml (with default configuration) instead of full or full-ha.我使用的是standalone.xml (默认配置)而不是fullfull-ha。
  • I have removed <distributable/> from web.xml (although the result is same either I add it or not to web.xml).我已经从 web.xml 中删除了<distributable/> (尽管结果是相同的,我将它添加或不添加到 web.xml)。
  • I'm Using hazelcast-all.jar in my project.我在我的项目中使用hazelcast-all.jar

So, should I have to do anything in WildFly to stop using its inbuilt infispan clustering?那么,我是否应该在 WildFly 中做任何事情来停止使用其内置的 infispan 集群?

I've searched over and found this: https://developer.jboss.org/thread/266186?_sscc=t我搜索过并找到了这个: https : //developer.jboss.org/thread/266186?_sscc=t

I'm sure I'm missing something while configuring the app with wildfly.我确定在使用 wildfly 配置应用程序时我遗漏了一些东西。

Any help would be appreciated.任何帮助,将不胜感激。

Removing from web.xml will cause WildFly to use a ConcurrentHashMap-based session manager (ie no more Infinispan).从 web.xml 中删除将导致 WildFly 使用基于 ConcurrentHashMap 的会话管理器(即不再使用 Infinispan)。 Spring Session is supposed to hijack the request such that no HttpSessions are ever created (in WF's session manager). Spring Session 应该劫持请求,这样就不会创建 HttpSessions(在 WF 的会话管理器中)。 This means you can't use WildFly to manage security (ie standard JEE authentication/authorization), as everything will need to be managed by Spring.这意味着您不能使用 WildFly 来管理安全性(即标准 JEE 身份验证/授权),因为一切都需要由 Spring 管理。

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

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