79671580

Date: 2025-06-19 05:48:48
Score: 1
Natty:
Report link

This Behavior is cuased by Vaadin's heartbeat mechanism. By default Vaddin periodically send heartbeat requests from the client to the server to keep the session alive. When ou are using spring Session JDBC with a very short timeout 60 seconds and the heartbeat interval is longer than the session timeout, the session expire before the next heartbeat, causing the client to reload.

UI.getCurrent().setPollInterval(10000);

this sets the polling interval, not the heartbeat interval. Heartbeat is a separate mechanism.

Option 1: Increase Session Timeout

Set a longer session timeout (e.g., 5 or 10 minutes):

@EnableJdbcHttpSession(maxInactiveIntervalInSeconds = 300) // 5 minutes

server.servlet.session.timeout=5m

This gives Vaadin enough time to send heartbeats or user activity to extend the session

or other option in application.properties

vaadin.heartbeatInterval=30

or another option

handle expired sessions gracefully, you can add @WebMvcConfigurer to redirect to a login page or any error page when the session expires instead of allowing Vaadin to loop.

Also in application.properties

server.error.whitelabel.enabled=false

server.error.path=/login

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • User mentioned (1): @WebMvcConfigurer
  • Low reputation (0.5):
Posted by: Muhammad Maroof