Servlet 2.2 specifically rejected this for security reasons, so there should not be an official way to do this. Not recommended, but you can try using Manager.findSession () if using Tomcat.
I just uninstalled HttpSession from my application. It is very difficult to synchronize sessions when many servers are running. We tried to configure it by writing our own manager, but we can not get it to work correctly. Finally, we wrote our own session with approximately 500 lines of code, and it works much better.
source share