Hazelcast 4.x support
See original GitHub issueHello, I’ve been encountering an issue when trying to move my solution to Hazelcast 4.x. Last time I used SARL it was with Hazelcast 3.12 as I needed to communicate with Python client that did not yet support version 4.
Is your feature request related to a problem? Please describe. After a few hours trying to figure out where the problem actually was, I found out it happened only when starting my application from a SARL context. When running this sample code in Java, everything ran smoothly:
public class TopicSample implements MessageListener<String> {
@Override
public void onMessage(Message<String> message) {
System.out.println("Got message " + message.getMessageObject());
}
public static void main(String[] args) {
Config config = new Config();
// Start the Embedded Hazelcast Cluster Member.
HazelcastInstance hz = Hazelcast.newHazelcastInstance(config);
// Get a Topic called "my-distributed-topic"
ITopic<String> topic = hz.getTopic("my-distributed-topic");
// Add a Listener to the Topic
topic.addMessageListener(new TopicSample());
// Publish a message to the Topic
topic.publish("Hello to distributed world");
// Shutdown the Hazelcast Cluster Member
hz.shutdown();
}
}
However when I ran this equivalent agent, I got a problem when I try to get the hazelcast instance:
agent SimpleAgent {
on Initialize {
var hcConfig = new Config
var hcInstance = Hazelcast.newHazelcastInstance()
var topic = hcInstance.getTopic("test")
topic.addMessageListener(new MessageListener<String>(){
def onMessage(message : Message<String>) {
println("Got message " + message.getMessageObject)
}
})
topic.publish("Hello to distributed world")
hcInstance.shutdown
}
}
I get the following Stacktrace:
[SEVERE, 12:40:13pm, com.hazelcast.instance.impl.Node] [130.104.204.20]:5702 [dev] [4.1.1] Node creation failed
java.lang.NoSuchMethodError: com.hazelcast.internal.serialization.impl.ArrayDataSerializableFactory.<init>([Lcom/hazelcast/util/ConstructorFunction;)V
at com.hazelcast.mapreduce.aggregation.impl.AggregationsDataSerializerHook.createFactory(AggregationsDataSerializerHook.java:432)
at com.hazelcast.internal.serialization.impl.DataSerializableSerializer.<init>(DataSerializableSerializer.java:68)
at com.hazelcast.internal.serialization.impl.SerializationServiceV1.<init>(SerializationServiceV1.java:145)
at com.hazelcast.internal.serialization.impl.SerializationServiceV1$Builder.build(SerializationServiceV1.java:405)
at com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder.createSerializationService(DefaultSerializationServiceBuilder.java:300)
at com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder.build(DefaultSerializationServiceBuilder.java:236)
at com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder.build(DefaultSerializationServiceBuilder.java:55)
at com.hazelcast.instance.impl.DefaultNodeExtension.createSerializationService(DefaultNodeExtension.java:301)
at com.hazelcast.instance.impl.Node.<init>(Node.java:251)
at com.hazelcast.instance.impl.HazelcastInstanceImpl.createNode(HazelcastInstanceImpl.java:148)
at com.hazelcast.instance.impl.HazelcastInstanceImpl.<init>(HazelcastInstanceImpl.java:117)
at com.hazelcast.instance.impl.HazelcastInstanceFactory.constructHazelcastInstance(HazelcastInstanceFactory.java:211)
at com.hazelcast.instance.impl.HazelcastInstanceFactory.newHazelcastInstance(HazelcastInstanceFactory.java:190)
at com.hazelcast.instance.impl.HazelcastInstanceFactory.newHazelcastInstance(HazelcastInstanceFactory.java:128)
at com.hazelcast.core.Hazelcast.newHazelcastInstance(Hazelcast.java:91)
at be.uclouvain.aptitude.test.SimpleAgent.$behaviorUnit$Initialize$0(SimpleAgent.java:22)
at be.uclouvain.aptitude.test.SimpleAgent.lambda$0(SimpleAgent.java:31)
at io.janusproject.kernel.bic.internaleventdispatching.AgentInternalEventsDispatcher$1.run(AgentInternalEventsDispatcher.java:295)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:834)
Describe the solution you’d like I may be wring but I assume that the problem is that somehow that Hazelcast 4 is not yet supported. I first thought the problem came from Hazelcast side, but as it is very simple code and it was released several months ago, this now seems very unlikely and I found no such errors on the internet.
So that would be nice to support Hazelcast 4 in a next version. If you have any other clew, I’m all ears of course!
Describe alternatives you’ve considered I tried instantiating Hazelcast from a java class instead and get the instance from a SARL class, but I got the same exception so I guess it is related to SARL context.
So at the moment I moved back my code to target Hazelcast 3.12.12.
Additional context I’m using SARL 10.1 with JDK 11.0.7 on Windows 10 64 bits
Issue Analytics
- State:
- Created 3 years ago
- Comments:10 (6 by maintainers)
Top GitHub Comments
Indeed, I was using
SRE.main()
. I changed the main class for this one and give my SimpleAgent as argument but I still get the same stacktraceVersion 0.12 will be released in May 2021. Hazelcast is not any more included by default. It is inside a plugin that could be easily plugged in/out from your project. I think it is preferable for you to skip 0.11 if you have encountered issues with it.