I am a little bit confused. Could you tell me why I need to map twice the VaadinServlet?
I mapped it once and everything is working very well except the HEARTBEAT.
And if the HEARTBEAT uses /VAADIN and I mapped the vaadinServlet to /VAADIN why HEARTBEAT is not working?
/VAADIN/* is
only for static files. It needs to be available in addition to wherever your application is mapped.
HEARTBEAT should not be accessed from /VAADIN/ but from where you are running the application. However, you tried to access the application from the same location as the static resources. The Vaadin servlet uses special handling of resources in /VAADIN, serving static files faster and bypassing much of the other processing for it intentionally, which is why requests for HEARTBEAT (and many other things) at that path do not work. The application is not designed to run there.
The normal setup is mapping /* to a Vaadin servlet, in which case both the application (at the context root) and static resources (in VAADIN) get served by it. If for some reason you don’t map /* (and aren’t serving static resources in some other way bypassing the servlet), you should provide two separate mappings to the servlet: one for the application path and one for /VAADIN/* as noted in a previous post.
The most common reason for wanting to map the servlet somewhere else than the root would be having also other servlets in the same WAR, in which case providing the additional /VAADIN mapping should not be a problem. Is that the case for you or do you map it elsewhere for some other reason? I don’t really see any reason why the users would want to see /VAADIN/ in the servlet URL, at least.