Open helge79 opened 4 years ago
Hi @helge79, I checked this issue, and you are correct that it is not working as expected when you deploy multiple web applications on a single Tomcat container. In coming versions, there will be some improvements in Hazelcast's dynamic class loading, we are planning to use them to resolve this issue.
When two applications in Tomcat share a class definition the latter one will not be able to deserialize the attribute from the session because I assume the first application will hold the reference to this class. A
ClassCastException
will be thrown then.To illustrate the issue I have set up a project based on your Hazelcast's docker images. See https://github.com/helge79/hazelcast-session-classloading-issue for details. Instead of putting a simple
String
in the session I will use a class calledStringHolder
for it. I will built an application and deploy it asexample.war
andexample2.war
. Ifexample2.war
is deployed beforeexample.war
I will not be able to get the session attribute back in/example
.And I think this is intended as described in #55 and #56 because it is not possible to change the class loader after initialisation. But how is it possible to have one instance per Tomcat in a P2P scenario at all then? How is this supposed to work? What am I missing here? Are there any configuration issue on my end?