HTTP session is not getting reflected in infinispan

330 views
Skip to first unread message

Harshit Bhuva

unread,
Nov 16, 2021, 11:43:52 AM11/16/21
to WildFly
Hi Team,

Below are my requirement
I have four standalone wildlfy 20 server.
I want to store HTTP session and local cache + L2 cache in remote infinispan cluster server.
I tried with your configuration which is here shared but still I am not able to store HTTP session on infinispan server.
Kindly suggest steps for the configuration part.

Paul Ferraro

unread,
Nov 16, 2021, 2:26:02 PM11/16/21
to WildFly
Infinispan does not include a 2LC implementation that uses a remote infinispan cluster, rather it is implemented as a local invalidation cache.
Otherwise, you'll want to use something like Hibernate OGM.

Harshit Bhuva

unread,
Nov 17, 2021, 6:19:23 AM11/17/21
to Paul Ferraro, WildFly
Hi Paul,

As discussed earlier I have gone through one of your email threads and I found out that the configuration which I have shared below works for HTTP session replication to remote infinispan cluster server.

But I tried the same but it's not working for me.
Below is my scenario
1. Login with two different users on two different nodes (USER1 -> NODE1 AND USER2 -> NODE2).
2. Now shutdown NODE1
3. If I refresh the application page of USER1 then I should not get any logout page rather it should be redirected to node2, which is not happening with my case. I am getting a re-login page with a session timeout message.

Please help me with the configuration if I have missed something.
I am using wildfly 20 and infinispan 10.1.8 (remote server as of now single node)

Below are my configuration


I have added below configuration in my both standalone.xml (standalone server 1 and standalone server2)

<subsystem xmlns="urn:jboss:domain:infinispan:10.0">
<cache-container name="server" default-cache="default" module="org.wildfly.clustering.server">
<local-cache name="default">
<transaction mode="BATCH"/>
</local-cache>
</cache-container>

<!-- <cache-container name="web" default-cache="passivation" module="org.wildfly.clustering.web.infinispan">
<local-cache name="passivation">
<locking isolation="REPEATABLE_READ"/>
<transaction mode="BATCH"/>
<file-store passivation="true" purge="false"/>
</local-cache>
</cache-container> -->

<cache-container name="web" default-cache="dgt-web" module="org.wildfly.clustering.web.infinispan">
<transport lock-timeout="60000"/>
<invalidation-cache name="dgt-web">
<locking isolation="REPEATABLE_READ"/>
<transaction mode="BATCH"/>
<hotrod-store remote-cache-container="dgt_cache_container" fetch-state="false" passivation="false" purge="false" shared="true"/>
</invalidation-cache>
</cache-container>


<cache-container name="ejb" aliases="sfsb" default-cache="passivation" module="org.wildfly.clustering.ejb.infinispan">
<local-cache name="passivation">
<locking isolation="REPEATABLE_READ"/>
<transaction mode="BATCH"/>
<file-store passivation="true" purge="false"/>
</local-cache>
</cache-container>
<cache-container name="hibernate" module="org.infinispan.hibernate-cache">
<local-cache name="entity">
<object-memory size="10000"/>
<expiration max-idle="100000"/>
</local-cache>
<local-cache name="local-query">
<object-memory size="10000"/>
<expiration max-idle="100000"/>
</local-cache>
<local-cache name="timestamps"/>
</cache-container>


<remote-cache-container name="dgt_cache_container" default-remote-cluster="infinispan-cluster" module="org.wildfly.clustering.web.hotrod">
<remote-clusters>
  <remote-cluster name="infinispan-cluster" socket-bindings="remote-infinispan"/>
</remote-clusters>
</remote-cache-container>


</subsystem>

<socket-binding-group name="standard-sockets" default-interface="public" port-offset="${jboss.socket.binding.port-offset:0}">

        <outbound-socket-binding name="remote-infinispan">
               <remote-destination host="localhost" port="11222"/>
         </outbound-socket-binding>

</socket-binding-group>

Regards
Harshit B


--
You received this message because you are subscribed to the Google Groups "WildFly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/0e83a86b-d2bf-4b1b-8b2b-2130b67b30c0n%40googlegroups.com.

Paul Ferraro

unread,
Nov 17, 2021, 9:05:35 AM11/17/21
to WildFly
Is your web application distributable? i.e. does it specify <distributable/> within web.xml?

Harshit Bhuva

unread,
Nov 17, 2021, 9:52:26 AM11/17/21
to Paul Ferraro, WildFly
Hi Paul,

I have multiple standalone wildfly servers which are accessed via load balancer (Apache).

My server is not in cluster mode. Also I have not added <distributable/> within web.xml.

Regards
Harshit B


Paul Ferraro

unread,
Nov 17, 2021, 12:23:42 PM11/17/21
to WildFly
There's your problem.  You web application's /WEB-INF/web.xml must contain <distributable/>.  This is a servlet specification requirement needed to enable wildfly's distributed session manager.

Harshit Bhuva

unread,
Nov 17, 2021, 1:54:34 PM11/17/21
to Paul Ferraro, WildFly
Hi Paul,

Thanks for your reply.

I did the changes in web.xml and added 
<distributable/> and have started the server.

But now at the end of the server log I am getting error message saying few of the service failed to start. And I am unable to access my application page.



Harshit Bhuva

unread,
Nov 18, 2021, 5:43:10 AM11/18/21
to Paul Ferraro, WildFly
Hey Paul,

Any other configuration I need to change?

Regards
Harshit B

Paul Ferraro

unread,
Nov 18, 2021, 8:06:27 AM11/18/21
to WildFly
Please paste the relevant exceptions from the log.

Harshit Bhuva

unread,
Nov 18, 2021, 8:25:58 AM11/18/21
to Paul Ferraro, WildFly
Hi Paul,

Below error is coming in server.log at the end.

2021-11-18 18:52:04,881 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 101) WFLYUT0021: Registered web context: '/restapi' for server 'default-server'
2021-11-18 18:52:05,596 INFO  [org.wildfly.extension.undertow] (ServerService Thread Pool -- 115) WFLYUT0021: Registered web context: '/swift-api-doc' for server 'default-server'
2021-11-18 18:52:05,619 INFO  [org.jboss.as.server] (ServerService Thread Pool -- 39) WFLYSRV0010: Deployed "digite.ear" (runtime-name : "digite.ear")
2021-11-18 18:52:05,621 INFO  [org.jboss.as.controller] (Controller Boot Thread) WFLYCTL0183: Service status report
WFLYCTL0448: 16 additional services are down due to their dependencies being missing or failed
2021-11-18 18:52:05,856 INFO  [org.jboss.as.server] (Controller Boot Thread) WFLYSRV0212: Resuming server
2021-11-18 18:52:05,985 ERROR [org.jboss.as] (Controller Boot Thread) WFLYSRV0026: WildFly Full 20.0.1.Final (WildFly Core 12.0.3.Final) started (with errors) in 157597ms - Started 5640 of 5803 services (16 services failed or missing dependencies, 425 services are lazy, passive or on-demand)
2021-11-18 18:52:06,081 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on http://127.0.0.1:10090/management
2021-11-18 18:52:06,091 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on http://127.0.0.1:10090


Regards
Harshit B


Paul Ferraro

unread,
Nov 18, 2021, 11:27:05 AM11/18/21
to WildFly
Can you include the exceptions logged for those services that failed to start?
Reply all
Reply to author
Forward
0 new messages