Important Notice - Forums is archived

To simplify things and help our users to be more productive, we have archived the current forum and focus our efforts on helping developers on Stack Overflow. You can post new questions on Stack Overflow or join our Discord channel.

Product icon

Vaadin lets you build secure, UX-first PWAs entirely in Java.
Free ebook & tutorial.

Migrating from addon SpringVaadinIntegration to Vaadin Spring (official)

Francesco M
7 years ago Jul 31, 2015 9:23am
Vit Foldyna
7 years ago Aug 04, 2015 7:33am

Hi Francesco,

each request gets to the instance of VaadinServlet.class and is processed in its method service(HttpServletRequest request, HttpServletResponse response). In this method there is check whether the request is for static resource request.getRequestURI().startsWith(request.getContextPath() + "/VAADIN/") and in the end of the method is called getService().handleRequest(vaadinRequest, vaadinResponse) method from VaadinService.class.

The method handleRequest(vaadinRequest, vaadinResponse) loops over request handlers and on each hander calls handleRequest(vaadinSession, request, response) method. This method is

called when a request needs to be handled. If a response is written, this method should return true to indicate that no more request handlers should be invoked for the request. (method comment)

If there is not found any handler that could handle the request the response is set to "Request was not handled by any registered handler."

// Request not handled by any RequestHandler
response.sendError(HttpServletResponse.SC_NOT_FOUND, "Request was not handled by any registered handler.");

In my project I had problem when the url was other than default project url. The url http://localhost:8080/my_project/ was ok but http://localhost:8080/my_project/something returned "HTTP Status 404 - Request was not handled by any registered handler." response.

I have checked all my request handlers


and found out that problem was in the last one - ServletBootstrapHandler.

When handleRequest(vaadinSession, request, response) is called on ServletBootstrapHandler the flow gets through the SynchronizedRequestHandler's method handleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response) to BootstrapHandler's method synchronizedHandleRequest(VaadinSession session, VaadinRequest request, VaadinResponse response). In this method there is loop through list of UIProviders. In my former Spring project the UIProvider was instance of DefaultUIProvider.class. In my current project it is instance of SpringUIProvider.class. SpringUIProvider.class implementation of getUIClass(UIClassSelectionEvent uiClassSelectionEvent) method differs from the DefaultUIProvider.class. To work properly I had to add path value to @SpringUI annotation. In your case it would be

@SpringUI(path = "/*")
public class MyUI extends UI

I am not sure if this solves your problem but I hope it at least points you out to the right direction.

Francesco M
7 years ago Aug 13, 2015 1:46pm