gpt4 book ai didi

java - 远程 Hazelcast Quartz JobStore 抛出 ClassNotFoundException

转载 作者:行者123 更新时间:2023-12-02 11:40:59 26 4
gpt4 key购买 nike

我正在使用这个hazelcast quartz scheduler JobStore用于调度后台作业。我正在使用:

  • quartz :2.2.3
  • Hazelcast:3.7.2(使用默认配置在 Docker 容器中运行)
  • Hazelcast 客户端:3.7.2

向 hazelcast-quartz 调度程序添加新触发器时,我在 hazelcast 实例上遇到以下异常:

[3.7.2] java.lang.ClassNotFoundException: com.bikeemotion.quartz.jobstore.hazelcast.TriggerWrapper com.hazelcast.nio.serialization.HazelcastSerializationException: java.lang.ClassNotFoundException: com.bikeemotion.quartz.jobstore.hazelcast.TriggerWrapper at com.hazelcast.internal.serialization.impl.JavaDefaultSerializers$JavaSerializer.read(JavaDefaultSerializers.java:224) at com.hazelcast.internal.serialization.impl.StreamSerializerAdapter.read(StreamSerializerAdapter.java:46) at com.hazelcast.internal.serialization.impl.AbstractSerializationService.toObject(AbstractSerializationService.java:172) at com.hazelcast.map.impl.record.Records.tryStoreIntoCache(Records.java:149) at com.hazelcast.map.impl.record.Records.getValueOrCachedValue(Records.java:118) at com.hazelcast.map.impl.recordstore.AbstractRecordStore.saveIndex(AbstractRecordStore.java:146) at com.hazelcast.map.impl.recordstore.DefaultRecordStore.putInternal(DefaultRecordStore.java:741) at com.hazelcast.map.impl.recordstore.DefaultRecordStore.set(DefaultRecordStore.java:919) at com.hazelcast.map.impl.operation.SetOperation.run(SetOperation.java:44) at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run(OperationRunnerImpl.java:181) at com.hazelcast.spi.impl.operationexecutor.impl.OperationExecutorImpl.run(OperationExecutorImpl.java:375) at com.hazelcast.spi.impl.operationexecutor.impl.OperationExecutorImpl.runOrExecute(OperationExecutorImpl.java:402) at com.hazelcast.spi.impl.operationservice.impl.Invocation.doInvokeLocal(Invocation.java:283) at com.hazelcast.spi.impl.operationservice.impl.Invocation.doInvoke(Invocation.java:268) at com.hazelcast.spi.impl.operationservice.impl.Invocation.invoke0(Invocation.java:232) at com.hazelcast.spi.impl.operationservice.impl.Invocation.invoke(Invocation.java:207) at com.hazelcast.spi.impl.operationservice.impl.InvocationBuilderImpl.invoke(InvocationBuilderImpl.java:59) at com.hazelcast.client.impl.protocol.task.AbstractPartitionMessageTask.processMessage(AbstractPartitionMessageTask.java:64) at com.hazelcast.client.impl.protocol.task.AbstractMessageTask.initializeAndProcessMessage(AbstractMessageTask.java:119) at com.hazelcast.client.impl.protocol.task.AbstractMessageTask.run(AbstractMessageTask.java:99) at com.hazelcast.spi.impl.operationservice.impl.OperationRunnerImpl.run(OperationRunnerImpl.java:137) at com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.process(OperationThread.java:127) at com.hazelcast.spi.impl.operationexecutor.impl.OperationThread.run(OperationThread.java:102) Caused by: java.lang.ClassNotFoundException: com.bikeemotion.quartz.jobstore.hazelcast.TriggerWrapper at java.net.URLClassLoader$1.run(URLClassLoader.java:366) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at com.hazelcast.nio.ClassLoaderUtil.tryLoadClass(ClassLoaderUtil.java:151) at com.hazelcast.nio.ClassLoaderUtil.loadClass(ClassLoaderUtil.java:120) at com.hazelcast.nio.IOUtil$ClassLoaderAwareObjectInputStream.resolveClass(IOUtil.java:358) at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1620) at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1521) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1779) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1353) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:373) at com.hazelcast.internal.serialization.impl.JavaDefaultSerializers$JavaSerializer.read(JavaDefaultSerializers.java:219) ... 22 more

对可能出现的问题有什么想法吗?我真的不想让 hazelcast 实例知道 hazelcast jobstore 包。应该能够存储触发器,而不必在 hazelcast 实例上反序列化它。

最佳答案

@philip-wiebe,请参阅https://github.com/FlavioF/quartz-scheduler-hazelcast-jobstore/blob/master/src/main/java/com/bikeemotion/quartz/jobstore/hazelcast/HazelcastJobStore.java#L116

triggersByKeynextFireTime 属性(本例中为方法)上有一个索引。这就是节点尝试创建索引并尝试反序列化数据的原因。您还需要在成员类路径中包含 quartz-scheduler-hazelcast-jobstore 和 quartz 相关类。

注意:HazelcastJobStore 也有一个自定义谓词,该谓词也需要可供成员使用:https://github.com/FlavioF/quartz-scheduler-hazelcast-jobstore/blob/master/src/main/java/com/bikeemotion/quartz/jobstore/hazelcast/HazelcastJobStore.java#L1259

关于java - 远程 Hazelcast Quartz JobStore 抛出 ClassNotFoundException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48552718/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com