hazelcast / hazelcast-tomcat-sessionmanager

Tomcat Based Web Session Replication
Other
33 stars 37 forks source link

Still classloading issues #74

Open helge79 opened 4 years ago

helge79 commented 4 years ago

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 called StringHolder for it. I will built an application and deploy it as example.war and example2.war. If example2.war is deployed before example.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?

alparslanavci commented 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.