hazelcast with payara in docker in AWS

Skip to first unread message

Hans Pikkemaat

Sep 29, 2021, 8:13:29 AM9/29/21
to Payara Forum

I'm using the latest version of payara.
I'm running payara inside a docker container in AWS in an EC2 instance.
I want to use Hazelcast so I want both instances to be able to find each other.

This is what I did:

- configure AWS security group in which the instances are running to accept connections on port 4900
- enable hazelcast
     - set-hazelcast-configuration --enabled true
- restart payara
- find ip addresses of instances using aws query
- configure tcpip 
     - set-hazelcast-configuration --dynamic --clustermode tcpip --tcpipmembers <ip1>:4900,<ip2>:4900

I can see in the logs that hazelcast is restarting but get this Exception:

java.lang.IllegalArgumentException: Target is this node! -> []:4900

It simply doesn't work.

What am I doing wrong?

regards, Hans

Rudy De Busscher

Sep 30, 2021, 7:39:30 AM9/30/21
to Payara Forum

Can it be possible that Hazelcast is starting on an 'internal' IP address of the container (and not the one you supplied in set-hazelcast-configuration)

You might get more feedback on a Hazelcast forum about this issue (What configuration must be used to join 2 Hazelcast instances in Docker on EC2 using tcpip mode)

PS, no need to enable hazelcast as it is active by default and it is not recommended to restart Payara within Docker Container (perform any config in the build image step)


Rudy De Busscher

Oct 2, 2021, 2:11:22 PM10/2/21
to Payara Forum
Hi Hans,

I'm not familiar enough with AWS to help you on you issue as it seems to work perfectly within 'plain docker' as you mention.

Community version is using Hazelcast 4.x and thus should support the Hazelcast-aws library. Some additional links that might give you more info

Info on how to configure Hazelcast in AWS : https://hazelcast.com/blog/how-to-set-up-hazelcast-imdg-on-aws-ecs/

Easiest way to find out if custom config file is used is to use invalid content in the xml file and see if this results in an error at startup.

The file must be in the <PAYARA_HOME>/glassfish/domains/<domain>/config directory and only the filename can be specified in the Payara config. 


-- received outside of Forum


I found a lot of information about configuring hazelcast but the big question is if I can simply use a hazelcast configuration file (as described on the hazelcast website) and configure that in payara.

I tried that but did not get any feedback in the logs about that configuration being loaded and also 'get-hazelback-configuration' doesn't show information from that configuration file. So how can I confirm that payara has loaded the hazelback-config.xml file that I supply? 

I also found a hazelcast-aws library which I loaded using 'add-library' but did not see any changes. Do you know if that is necessary?

Could you let me know how to enable debug logging in payara for hazelback? Maybe I can find out more about what is happening.


PS: I was able to setup two payara DAS servers in docker (in the same network) with tcpip mode. But was unable to set it up like this in AWS. See here: https://github.com/thehpi/payara-server-hazelcast
Reply all
Reply to author
0 new messages