Thomas Junk
Thomas Junk

Reputation: 5676

JSESSIONID and hazelcast.sessionId

currently we are deploying to a cluster-scenario where we have 3 nodes (tomcat), all of them share their sessions via Hazelcast. We have an apache in front of these nodes as a loadbalancer.

curling our application, I see, that there are two session-cookies used:

1) is the usual tomcat session with a JSESSIONID

2) is the hazelcast-session with a hazelcast.sessionId

Is there any way to omit the JSESSIONID?

or

Is there any way to somehow "join" both? Thanks in advance.

Upvotes: 2

Views: 2093

Answers (1)

mdogan
mdogan

Reputation: 1949

No, both are required in current implementation.

Hazelcast uses only hazelcast.sessionId as HttpSession.getId() and nearly everyplace to identify distributed session. But for some cases like failover Hazelcast uses both session identifiers (hazelcast.sessionId and JSESSIONID ) internally.

From Hazelcast documentation:

SessionId Generation

SessionId generation is done by Hazelcast Web Session Module if session replication is configured in the web application. Default cookie name for the sessionId is hazelcast.sessionId and this is configurable with cookie-name parameter in the web.xml file of the application. hazelcast.sessionId is just a UUID prefixed with “HZ” character and without “-“ character, e.g. HZ6F2D036789E4404893E99C05D8CA70C7.

When called by the target application, the value of HttpSession.getId() is the same as the value of hazelcast.sessionId.

Upvotes: 4

Related Questions