You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Unmatched DispatcherServlet requests fail with "No servlet with name 'springServlet'" when the app registers the Vaadin servlet itself and vaadin.urlMapping isn't set #27244
VaadinServletConfiguration is applied whenever RootMappedCondition matches, and that condition only looks at the vaadin.urlMapping property: when the property isn't set, the Vaadin servlet is assumed to be mapped to /*. The configuration then adds vaadinRootMapping, a catch-all (/**) handler mapping, to every DispatcherServlet that uses the context. It forwards unmatched requests to a servlet named springServlet, which is the name VaadinMVCWebAppInitializer and the Spring Boot auto-configuration give the Vaadin servlet when they register it at /vaadinServlet/* behind a root-mapped DispatcherServlet.
An application that registers the servlets itself doesn't match that assumption. This happens with a plain Spring (non-Boot) app that:
imports VaadinServletConfiguration, directly or through @EnableVaadin,
registers the Vaadin SpringServlet itself in its own WebApplicationInitializer, e.g. at /gui/*, under another name,
registers its own DispatcherServlet, e.g. at /api/*,
doesn't set vaadin.urlMapping, because it never uses that property to register anything.
Then any request to the DispatcherServlet that no controller handles, e.g. /api/blah, is routed to the forwarding controller instead of producing a 404, and fails with a 500:
jakarta.servlet.ServletException: No servlet with name 'springServlet' defined in web.xml
at org.springframework.web.servlet.mvc.ServletForwardingController.handleRequestInternal(ServletForwardingController.java:127)
at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:177)
at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:49)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
...
The only workaround today is to set vaadin.urlMapping to a non-root value, even though nothing reads it to register a servlet in this setup.
When there is no Vaadin servlet to forward to, Vaadin shouldn't take over unmatched DispatcherServlet requests: /api/blah should give the normal 404.
Possible fix: have RootExcludeHandler (or the vaadinRootMapping bean) return no handler when the servlet context has no servlet registered under the forwarding controller's name (ServletContext.getServletRegistration("springServlet") == null). The root-mapped setups that Vaadin registers itself keep working, because there the servlet exists. A stricter alternative is to also skip it when the DispatcherServlet handling the request isn't mapped to /.
Minimal reproducible example
Create a Spring MVC application without Spring Boot, with a root configuration annotated with @EnableVaadin (or importing VaadinServletConfiguration), and don't set vaadin.urlMapping.
In your own WebApplicationInitializer, register new SpringServlet(context, false) under a name other than springServlet at /gui/*, and a DispatcherServlet at /api/*.
Deploy and request /api/does-not-exist. Expected 404; actual 500 with the exception above.
changed the title [-]Unmatched DispatcherServlet requests fail with "No servlet with name 'springServlet'" when Vaadin registers its servlets elsewhere and vaadin.urlMapping isn't set[/-][+]Unmatched DispatcherServlet requests fail with "No servlet with name 'springServlet'" when the app registers the Vaadin servlet itself and vaadin.urlMapping isn't set[/+]on Nov 24, 2026
Triage: confirmed bug. A plain Spring app that registers the Vaadin servlet itself gets a 500 instead of a 404 for every DispatcherServlet request no controller handles.
Affects: apps that import VaadinServletConfiguration (e.g. via @EnableVaadin), register SpringServlet themselves under a name other than springServlet, and don't set vaadin.urlMapping.
Affected branches: main and all maintained branches (24.9, 25.x) have the same code.
Regression: no — long-standing behavior.
Severity: moderate — wrong status code and a server error logged; real routes still work.
Impact: low — only hand-written servlet registration without Spring Boot.
Workaround: set vaadin.urlMapping to a non-root value such as /gui/*. It only disables the catch-all mapping in this setup.
Root cause: without vaadin.urlMapping, Vaadin assumes it registered a root-mapped servlet named springServlet and forwards all unmatched requests to it, without checking that the servlet exists.
RootMappedCondition treats a missing vaadin.urlMapping as /*, so VaadinServletConfiguration is applied.
Its vaadinRootMapping bean maps /** at lowest-but-one precedence to a ServletForwardingController for springServlet.
That name exists only when Vaadin registers the servlet (VaadinMVCWebAppInitializer, Spring Boot auto-configuration). Otherwise ServletForwardingController finds no named dispatcher and throws ServletException.
Activity
[-]Unmatched DispatcherServlet requests fail with "No servlet with name 'springServlet'" when Vaadin registers its servlets elsewhere and vaadin.urlMapping isn't set[/-][+]Unmatched DispatcherServlet requests fail with "No servlet with name 'springServlet'" when the app registers the Vaadin servlet itself and vaadin.urlMapping isn't set[/+]totally-not-ai commentedon Nov 24, 2026
Triage: confirmed bug. A plain Spring app that registers the Vaadin servlet itself gets a 500 instead of a 404 for every
DispatcherServletrequest no controller handles.VaadinServletConfiguration(e.g. via@EnableVaadin), registerSpringServletthemselves under a name other thanspringServlet, and don't setvaadin.urlMapping.vaadin.urlMappingto a non-root value such as/gui/*. It only disables the catch-all mapping in this setup.vaadin.urlMapping, Vaadin assumes it registered a root-mapped servlet namedspringServletand forwards all unmatched requests to it, without checking that the servlet exists.Root cause
RootMappedConditiontreats a missingvaadin.urlMappingas/*, soVaadinServletConfigurationis applied.vaadinRootMappingbean maps/**at lowest-but-one precedence to aServletForwardingControllerforspringServlet.VaadinMVCWebAppInitializer, Spring Boot auto-configuration). OtherwiseServletForwardingControllerfinds no named dispatcher and throwsServletException.archiecobbs commentedon Nov 24, 2026
Here is a reproducer: https://github.com/archiecobbs/vaadin-flow-bugs/tree/flow-issue-27244