zk+spring+hazelcast clustering getting error while iterating Hashmap in zul

asked 2022-04-07 00:11:25 +0800

wastemails gravatar image wastemails
130 1 2

updated 2022-04-07 00:12:01 +0800

while iterating Hashmap in zul as below getting serialization error

<forEach items="@load(vm.lastUpdated.entrySet())" >
  <label  value=@load(each.key)/>
delete flag offensive retag edit

3 Answers

Sort by ยป oldest newest most voted

answered 2022-04-07 10:07:34 +0800

MDuchemin gravatar image MDuchemin
2480 1 6
ZK Team

How are you using Hazelcast in this project? Sharing data between instances, clustering, fallback, etc.

According to JavaDoc, the Set retrieved from map.entrySet(): "The set is backed by the map, so changes to the map are reflected in the set, and vice-versa. If the map is modified while an iteration over the set is in progress the results of the iteration are undefined."

Is it be possible that the map content is modified by hazelcast while iteration is happening? You could try using a ConcurrentHashMap or an IMap instead, to see if this is a concurrent access issue.

Usual ZK clustering questions below:

  • Have you setup ZK's SerializableUiFactory?
  • Do you have a global desktop cache? (not supported in serialization)
  • if you do session clustering, did you enable sticky sessions?
link publish delete flag offensive edit

answered 2022-04-07 14:31:53 +0800

wastemails gravatar image wastemails
130 1 2

updated 2022-04-07 14:44:07 +0800

0)Using two zk web applications for High availability if one application failed the other application should take over without loosing session information.

1)Disabled websocket

2) Configured zk.xml with the following for clustering


3)No Global Desktop cache is enabled

4)Using Nginx as loadbalancer with the following settings

upstream backend.com{
  listen 80;
  server_name backend.com;
  location / {
       proxy_pass        http://backend.com;
       proxy_set_header Upgrade  $http_upgrade;
       proxy_set_header Connection "upgrade";
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
       proxy_set_header X-Forwarded-Proto $scheme;
       proxy_set_header X-Forwarded-Port $server_port;
       proxy_set_header Host $host;
       proxy_read_timeout 5000;


5) In zul Hashmap is iterated with entrySet() for displaying data only, no concurrent modifications are done during iteration

6)As suggested tried with ConcurrentHashMap also getting the same error

link publish delete flag offensive edit

answered 2022-04-07 16:27:18 +0800

MDuchemin gravatar image MDuchemin
2480 1 6
ZK Team

I'm not familiar with Nginx enough, but you'll probably want to check if sticky sessions are enabled. (for ZK clustering, you generally want the load balancer to pass all requests from a give user to the same node, as long as that node is available, and only change the target node in a fallback situation).

So far not seeing anything obvious. Could you post the entire error stack trace? It's not clear to me what is exactly failing here.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2022-04-07 00:11:25 +0800

Seen: 10 times

Last updated: Apr 07 '22

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More