删除HazelClient复制映射的专用成员上的Hazelcast ClassNotFoundError



我最近在专用服务器/Hazalcast客户端环境中使用ReplicatedMaps时遇到了Hazelcast问题。我为它做了一个Stackloverflow帖子,并为它制作了一张Hazelcast Ticket。在客户端中使用近缓存的Hazelcast ClassNotFound我继续在我的环境中工作,偶然发现了另一个错误。我不确定我的另一个问题是否会得到解决,所以我在这里发布了一个新问题:我的环境是:我得到了一个专用的Hazelcast 3.9.3服务器,它有一个稍微修改过的hazecast.xml。我添加了

<replicatedmap name="default">
<in-memory-format>BINARY</in-memory-format>
<statistics-enabled>true</statistics-enabled>
</replicatedmap>

我启动Hazelcast服务器并查看控制台消息。

我还编码了一个测试客户端:

package de.empic.hazelwar;
import com.hazelcast.client.HazelcastClient;
import com.hazelcast.client.config.ClientConfig;
import com.hazelcast.core.HazelcastInstance;
import de.empic.hazelwar.model.Cache;
import java.util.Map;
public class Main {
public static final String HAZELCAST_INSTANCE_NAME = "HAZI";
public static final String REPLICATEDMAP_NAME = "REP_MAP";
public static final String MY_KEY = "MyKey";
public static void main(String[] args) {
init();
HazelcastInstance instance = HazelcastClient.getHazelcastClientByName(HAZELCAST_INSTANCE_NAME);
Map<String, Object> repMap = instance.getReplicatedMap(REPLICATEDMAP_NAME);
try {
repMap.remove(MY_KEY);
repMap.put(MY_KEY, new Cache());
} catch (Exception e) {
e.printStackTrace();
}
finally
{
instance.shutdown();
}
}
private static void init() {
ClientConfig cfg = new ClientConfig();
cfg.setInstanceName(HAZELCAST_INSTANCE_NAME);
// for analysis in the hazelcast management console
cfg.getProperties().put("hazelcast.client.statistics.enabled", "true");
cfg.getProperties().put("hazelcast.client.statistics.period.seconds", "60");
cfg.getNetworkConfig().addAddress("127.0.0.1:5701");
if (HazelcastClient.newHazelcastClient(cfg) == null) {
System.err.println(" !!! ERROR in Cache Config !!!");
}
}
}

我所做的是在上一次运行完成后直接启动客户端几次。每次发射我都会收到一个异常:

INFORMATION: [127.0.0.1]:5701 [dev] [3.9.2] Received auth from Connection[id=16, /127.0.0.1:5701->/127.0.0.1:50403, endpoint=null, alive=true, type=JAVA_CLIENT], successfully authenticated, principal: ClientPrincipal{uuid='68356b07-32dd-4e11-82ed-e3a4611da5a0', ownerUuid='ff081a0d-a52d-47ba-a294-232cee60cd55'}, owner connection: true, client version: 3.9.3
Dez 06, 2018 2:03:23 PM com.hazelcast.replicatedmap.impl.operation.RemoveOperation
SCHWERWIEGEND: [127.0.0.1]:5701 [dev] [3.9.2] java.lang.ClassNotFoundException: de.empic.hazelwar.model.Cache
com.hazelcast.nio.serialization.HazelcastSerializationException: java.lang.ClassNotFoundException: de.empic.hazelwar.model.Cache
at com.hazelcast.internal.serialization.impl.JavaDefaultSerializers$JavaSerializer.read(JavaDefaultSerializers.java:224)
at com.hazelcast.internal.serialization.impl.StreamSerializerAdapter.read(StreamSerializerAdapter.java:48)
at com.hazelcast.internal.serialization.impl.AbstractSerializationService.toObject(AbstractSerializationService.java:185)
at com.hazelcast.spi.impl.NodeEngineImpl.toObject(NodeEngineImpl.java:339)
at com.hazelcast.replicatedmap.impl.record.DataReplicatedRecordStore.unmarshall(DataReplicatedRecordStore.java:38)
at com.hazelcast.replicatedmap.impl.record.AbstractReplicatedRecordStore.remove(AbstractReplicatedRecordStore.java:85)
at com.hazelcast.replicatedmap.impl.record.AbstractReplicatedRecordStore.remove(AbstractReplicatedRecordStore.java:60)
at com.hazelcast.replicatedmap.impl.operation.RemoveOperation.run(RemoveOperation.java:50)
at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run(OperationRunnerImpl.java:194)
at com.hazelcast.spi.impl.operationexecutor.impl.OperationExecutorImpl.run(OperationExecutorImpl.java:406)
at com.hazelcast.spi.impl.operationexecutor.impl.OperationExecutorImpl.runOrExecute(OperationExecutorImpl.java:433)
at com.hazelcast.spi.impl.operationservice.impl.Invocation.doInvokeLocal(Invocation.java:569)
at com.hazelcast.spi.impl.operationservice.impl.Invocation.doInvoke(Invocation.java:554)
at com.hazelcast.spi.impl.operationservice.impl.Invocation.invoke0(Invocation.java:513)
at com.hazelcast.spi.impl.operationservice.impl.Invocation.invoke(Invocation.java:207)
at com.hazelcast.spi.impl.operationservice.impl.InvocationBuilderImpl.invoke(InvocationBuilderImpl.java:60)
at com.hazelcast.client.impl.protocol.task.AbstractPartitionMessageTask.processMessage(AbstractPartitionMessageTask.java:67)
at com.hazelcast.client.impl.protocol.task.AbstractMessageTask.initializeAndProcessMessage(AbstractMessageTask.java:123)
at com.hazelcast.client.impl.protocol.task.AbstractMessageTask.run(AbstractMessageTask.java:103)
at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run(OperationRunnerImpl.java:154)
at com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.process(OperationThread.java:125)
at com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.run(OperationThread.java:100)
Caused by: java.lang.ClassNotFoundException: de.empic.hazelwar.model.Cache
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.hazelcast.nio.ClassLoaderUtil.tryLoadClass(ClassLoaderUtil.java:173)
at com.hazelcast.nio.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:147)
at com.hazelcast.nio.IOUtil$ClassLoaderAwareObjectInputStream.resolveClass(IOUtil.java:591)
at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1868)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1751)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:2042)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1573)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:431)
at com.hazelcast.internal.serialization.impl.JavaDefaultSerializers$JavaSerializer.read(JavaDefaultSerializers.java:219)
... 21 more

对我来说,在我告诉Hazelcast在内存存储中执行二进制操作后,它试图反序列化复制映射的内容,这看起来像是一个错误。

这是由Hazelcast 3.11.1修复的,昨天发布

这是一个bug,看https://github.com/hazelcast/hazelcast/issues/14235

相关内容

  • 没有找到相关文章

最新更新