Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Use the correct ClassLoader for the P2P solution #56

Closed
wants to merge 1 commit into from
Closed

WIP: Use the correct ClassLoader for the P2P solution #56

wants to merge 1 commit into from

Conversation

anton-johansson
Copy link

Closes #55

Ignore the temporary logging statements for now.

This solution works, however I'm still getting the exceptions. It looks like it tries with the "normal" class loader first, then uses the WebAppClassLoader.

Any ideas?

17-Jan-2019 14:53:24.731 INFO [http-apr-8080-exec-1] com.hazelcast.session.HazelcastSession.deserializeMap ANTON - deserializing map with class loader: java.net.URLClassLoader@23fc625e
17-Jan-2019 14:53:24.756 INFO [http-apr-8080-exec-1] com.hazelcast.session.HazelcastSession.deserializeMap ANTON - deserializing map with class loader: WebappClassLoader
  context: ROOT
  delegate: false
----------> Parent Classloader:
java.net.URLClassLoader@23fc625e

Verified

This commit was signed with the committer’s verified signature.
PettitWesley Wesley Pettit
@devOpsHazelcast
Copy link
Contributor

Can one of the admins verify this patch?

@anton-johansson
Copy link
Author

Yeah, would be great to figure out why I still get the exceptions. Why it seems to try the "regular" class loader first, before proceeding to the WebAppClassLoader that actually works.

@alparslanavci
Copy link
Contributor

@anton-johansson, your solution works on me, I don't see the different loaders problem. If you still face it, can you please change the log when deserializing the map as below:

LOG.info("ANTON - deserializing map with class loader: " + Thread.currentThread().getContextClassLoader() +
                "Thread stacktrace: " + Arrays.toString(Thread.currentThread().getStackTrace()));

Please send the output after reproducing your issue, if you can. This will help to see where they are called from.

@anton-johansson
Copy link
Author

Hi!

I actually decided to go for the client/server mode instead, for other reasons than this.

If anyone wants to take over this issue/PR, feel free! I could finish it, but I won't have any time for it right now.

@alparslanavci
Copy link
Contributor

@anton-johansson I created another PR (#58) to resolve the issue, by adding some refactoring. With that PR, the classloader is set as the context classloader (WebAppClassLoader).

However, your issue looks related to how the classloader is configured in Hazelcast. You can only configure it during the initialisation of the Hazelcast instance, and subsequent changes in the Config class won't affect the classloader. Thus, it is still possible to face some issues if the WebAppClassLoader is somehow changed after the startup.

I am closing this PR right now, please let us know if you have any updates.

@anton-johansson anton-johansson deleted the use-correct-classloader-for-p2p branch March 8, 2019 16:57
@anton-johansson anton-johansson restored the use-correct-classloader-for-p2p branch March 8, 2019 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ClassNotFoundException when deserializing session
4 participants