问题
I am using hazelcast-3.11.2
and SubZero-0.9
as global serializer. I am trying to configure Spring Session using this example. When I have more than one node in cluster - I get next exception when trying to get session id:
2019-03-20 15:01:59.088 ERROR 13635 --- [ration.thread-3] c.h.m.i.operation.EntryBackupOperation : [x.x.x.x]:5701 [hazelcast-group] [3.11.2] null
java.lang.NullPointerException: null at com.hazelcast.map.AbstractEntryProcessor$EntryBackupProcessorImpl.processBackup(AbstractEntryProcessor.java:83) at com.hazelcast.map.impl.operation.EntryOperator.process(EntryOperator.java:314) at com.hazelcast.map.impl.operation.EntryOperator.operateOnKeyValueInternal(EntryOperator.java:181) at com.hazelcast.map.impl.operation.EntryOperator.operateOnKey(EntryOperator.java:166) at com.hazelcast.map.impl.operation.EntryBackupOperation.run(EntryBackupOperation.java:60) at com.hazelcast.spi.impl.operationservice.impl.operations.Backup.run(Backup.java:158) at com.hazelcast.spi.Operation.call(Operation.java:170) at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.call(OperationRunnerImpl.java:208) at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run(OperationRunnerImpl.java:197) at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run(OperationRunnerImpl.java:413) at com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.process(OperationThread.java:153) at com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.process(OperationThread.java:123) at com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.run(OperationThread.java:110)
My instance config looks like this:
@Configuration
@EnableHazelcastHttpSession
public class HazelcastSessionConfig extends AbstractHttpSessionApplicationInitializer {
@Bean
public HazelcastInstance hazelcastInstance() {
Config config = new Config();
SubZero.useAsGlobalSerializer(config);
MapAttributeConfig attributeConfig = new MapAttributeConfig()
.setName(HazelcastSessionRepository.PRINCIPAL_NAME_ATTRIBUTE)
.setExtractor(PrincipalNameExtractor.class.getName());
config.getMapConfig(HazelcastSessionRepository.DEFAULT_SESSION_MAP_NAME)
.addMapAttributeConfig(attributeConfig)
.addMapIndexConfig(new MapIndexConfig(
HazelcastSessionRepository.PRINCIPAL_NAME_ATTRIBUTE, false));
return Hazelcast.newHazelcastInstance(config);
}
}
Removing SubZero from configuration, removes exception, so it looks like it is SubZero issue. I do use this instance as my cache provider also and hibernate second level cache, so I can not get rid off SubZero.
My thoughts were:
Having two different clusters: one for cache, another for session. Don't work for me, since I do not know how to configure Spring Session to use specific hazelcast instance (pass instance name, or bean itself etc)
Specify which classes should be used with SubZero - but since I have plenty and new classes going to be added - this is not the best idea
Will appreciate any help.
来源:https://stackoverflow.com/questions/55262028/hazelcast-spring-session-subzerokryo-entrybackupprocessorimpl-nullpointerexcep