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.

Hazelcast 4.x support

See original GitHub issue

Hello, 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:closed
  • Created 3 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
JonathanSamelsoncommented, Feb 11, 2021

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 stacktrace

0reactions
gallandarakhneorgcommented, Feb 11, 2021

Version 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Hazelcast IMDG 4.0 is Released
Hazelcast has offered Intel Optane DC Persistent Memory support for our Hot Restart persistence layer for some time now. In IMDG 4.0 we've...
Read more >
Hazelcast IMDG Release Notes
Hazelcast IMDG Open Source Edition Release Notes lists the new features, enhancements and fixed issues for each Hazelcast IMDG release.
Read more >
Releases · hazelcast/hazelcast - GitHub
Hazelcast IMDG Open Source New Features: Sorting Support for Hazelcast SQL: Added the support of SQL sorting feature. By using the newly implemented...
Read more >
Hazelcast - Wikipedia
It offers an Open Binary Client Protocol to support APIs for any binary programming language. The Hazelcast and open source community members have...
Read more >
hazelcast/hazelcast-4-rhel8 - Certified Container Image
Hazelcast Enterprise IMDG combines distributed data structures, distributed caching capabilities, elasticity, memcached support, and integration with Spring ...
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