sharing session between WARs

jsf, servlets, session

Solution

To the point, you just need to configure the server somehow to store the session in a cookie without a path. In case of Tomcat, you can just set `emptySessionPath` attribute of the `<Connector>` element to `true` in `/conf/server.xml`. Also see this Tomcat Configuration Reference.

<Connector ... emptySessionPath="true">

This however affects all webbaps deployed on the same server.

Update: as you are actually using Websphere (which uses Tomcat under the hoods), you need to alter the Tomcat connector in Websphere's `config.xml` to include the following attribute:

<attribute name="emptySessionPath">true</attribute>

Problem

Is it possible for the session data of one war file to be shared by other war file

Original source