There's more...

The best way to set up a Jakarta EE cluster today is by using containers (specially Docker containers). So, I'd recommend that you have a look at Chapter 11Rising to the Cloud – Java EE, Containers, and Cloud Computing. If you mix that content with this, you will have a powerful environment for your application.

To allow your application to share its session with all nodes in the cluster, you need to edit the web.xml file, find the web-app node, and insert this:

<distributable/>

Without it, your session clustering will not work.