question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

support for Hazelcast client-server topology user-code-deployment not working

See original GitHub issue

Hi everyone

im in the process of updating from spring session 1, we have been using the client-server setup for quite some time in production.

Now with the new EntryProcessor implementation of HazelcastSessionRepository i cannot get it to work with the code deployment sample described in the issue #1101 .

i’ve enabled code deployment both on the server and on the client via the following xml configurations.

Server:

<user-code-deployment enabled="true">
    <class-cache-mode>ETERNAL</class-cache-mode>
    <provider-mode>LOCAL_AND_CACHED_CLASSES</provider-mode>
</user-code-deployment>

Client:

<user-code-deployment enabled="true">
    <classNames>
        <className>org.springframework.session.Session</className>
        <className>org.springframework.session.MapSession</className>
    <className>org.springframework.session.hazelcast.SessionUpdateEntryProcessor</className>
    </classNames>
</user-code-deployment>

I know this config is working because it triggers a new downstream Error when hazelcast is trying to send the SessionUpdateEntryProcessor class to the server.

The Hazelcast server throws the following error:

repository.SessionUpdateEntryProcessor.process(SessionUpdateEntryProcessor.java:27)
hazelcast_1  | 	at com.hazelcast.map.impl.operation.EntryOperator.process(EntryOperator.java:318)
hazelcast_1  | 	at com.hazelcast.map.impl.operation.EntryOperator.operateOnKeyValueInternal(EntryOperator.java:181)
hazelcast_1  | 	at com.hazelcast.map.impl.operation.EntryOperator.operateOnKeyValue(EntryOperator.java:170)
hazelcast_1  | 	at com.hazelcast.map.impl.operation.EntryOperation$EntryOperationOffload$2.run(EntryOperation.java:343)
hazelcast_1  | 	at com.hazelcast.util.executor.CachedExecutorServiceDelegate$Worker.run(CachedExecutorServiceDelegate.java:227)
hazelcast_1  | 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
hazelcast_1  | 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
hazelcast_1  | 	at java.lang.Thread.run(Thread.java:748)
hazelcast_1  | 	at com.hazelcast.util.executor.HazelcastManagedThread.executeRun(HazelcastManagedThread.java:64)
hazelcast_1  | 	at com.hazelcast.util.executor.HazelcastManagedThread.run(HazelcastManagedThread.java:80)
hazelcast_1  | Caused by: java.lang.ClassNotFoundException: Failed to load class org.springframework.security.core.context.SecurityContextImpl from other members.
hazelcast_1  | 	at com.hazelcast.internal.usercodedeployment.impl.ClassLocator.tryToGetClassFromRemote(ClassLocator.java:157)
hazelcast_1  | 	at com.hazelcast.internal.usercodedeployment.impl.ClassLocator.handleClassNotFoundException(ClassLocator.java:95)
hazelcast_1  | 	at com.hazelcast.internal.usercodedeployment.UserCodeDeploymentService.handleClassNotFoundException(UserCodeDeploymentService.java:89)
hazelcast_1  | 	at com.hazelcast.internal.usercodedeployment.UserCodeDeploymentClassLoader.loadClass(UserCodeDeploymentClassLoader.java:57)
hazelcast_1  | 	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
hazelcast_1  | 	at com.hazelcast.nio.ClassLoaderUtil.tryLoadClass(ClassLoaderUtil.java:288)
hazelcast_1  | 	at com.hazelcast.nio.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:252)
hazelcast_1  | 	at com.hazelcast.nio.IOUtil$ClassLoaderAwareObjectInputStream.resolveClass(IOUtil.java:646)
hazelcast_1  | 	at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1866)
hazelcast_1  | 	at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1749)
hazelcast_1  | 	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2040)
hazelcast_1  | 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1571)
hazelcast_1  | 	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:431)
hazelcast_1  | 	at java.util.HashMap.readObject(HashMap.java:1409)
hazelcast_1  | 	at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
hazelcast_1  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
hazelcast_1  | 	at java.lang.reflect.Method.invoke(Method.java:498)
hazelcast_1  | 	at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1158)
hazelcast_1  | 	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2176)
hazelcast_1  | 	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2067)
hazelcast_1  | 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1571)
hazelcast_1  | 	at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:2285)
hazelcast_1  | 	at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2209)
hazelcast_1  | 	at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2067)
hazelcast_1  | 	at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1571)
hazelcast_1  | 	at java.io.ObjectInputStream.readObject(ObjectInputStream.java:431)
hazelcast_1  | 	at com.hazelcast.internal.serialization.impl.JavaDefaultSerializers$JavaSerializer.read(JavaDefaultSerializers.java:82)
hazelcast_1  | 	... 15 more

I’ve tried to add spring-security jars to the hazelcast server, this fixed this error but triggered more downstream dependency errors.

Does anyone know how to fix this error ? I’ve looked at the issues #1312 #1131 maybe they can fix my issue and the need to upload code to the hazelcast server.

To fix my situation i had to completely replace the HazelcastSessionRepository with my own implementation that uses the old way of get/put on the Hazelcast IMap. This is working for now.

Im looking forward to any suggesstions.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
michaelhaessigcommented, Jan 28, 2019

yes i’ve seen this test. i will try to find time this week to build a sample project.

0reactions
michaelhaessigcommented, May 14, 2019

@consult-kk - sorry for the delayed reply. as mentioned i did replace the full HazelcastSessionRepository to use the old logic from 1.0 with IMap#put instead of using EntryProcessors. This way no libraries are needed on the hazelcast server. If you need the full code let me know.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hazelcast Deployment Topology Considerations: To Embed ...
Hazelcast can be deployed in two topologies - namely Embedded and Client-Server. In this blog, we Hazelcast deployment.
Read more >
Connect to database using hazelcast client-server topology
If you cannot deploy it, you can use User Code Deployment feature to load those classes to Hazelcast cluster as well.
Read more >
hazelcast/hazelcast - Gitter
https://github.com/hazelcast/hazelcast-docker/issues/new ... how to implement hazelcast-backed spring session handling in a client-server topology?
Read more >
Hazelcast IMDG Enterprise Release Notes
Sorting Support for Hazelcast SQL: Added the support of SQL ... Fixed an issue where tasks were not running in parallel when they...
Read more >
Distributed Cache with Hazelcast and Spring - Reflectoring
We solve this problem by using a distributed cache. Hazelcast is a ... Hazelcast supports many distributed data structures for caching.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found