Skip to content

Route not found issue #60

@thigg

Description

@thigg

I'm getting RouteNotFound Errors after upgrading from 1.1.x to 1.2.8.

We're setting up with 2 packages:

routes = new Routes().autoDiscoverViews("company.view.view").autoDiscoverViews("company.testroutes");

initializing our own Servlet because we need weld:

MockVaadin.setup(MockedUI::new, new WeldMockVaadinServlet(routes, weld));`

Servlet and Service look like this:

public class WeldMockVaadinServlet extends MockVaadinServlet {

    private WeldInitiator _weld;

    public WeldMockVaadinServlet(final Routes routes, final WeldInitiator weld) {
        super(routes);
        _weld = weld;
    }

    @SneakyThrows
    @NotNull
    @Override
    protected VaadinServletService createServletService(@NotNull final DeploymentConfiguration deploymentConfiguration) {
        CdiMockService cdiMockService = new CdiMockService(_weld, this, deploymentConfiguration);
        cdiMockService.init();
        return cdiMockService;
    }
}

public class CdiMockService extends MockService {

    private final WeldInitiator _weld;

    public CdiMockService(final WeldInitiator weld, @NotNull final VaadinServlet servlet,
                          @NotNull final DeploymentConfiguration deploymentConfiguration) {
        super(servlet, deploymentConfiguration, MockedUI::new);
        System.setProperty("vaadin.i18n.provider",
                "company.infrastructure.translation.TranslationProvider");
        _weld = weld;
        addSessionInitListener(new SessionListener());
    }


    @Override
    protected Instantiator createInstantiator() throws ServiceException {
        BeanManager beanManager = _weld.getBeanManager();
        return new KaribuVaadinCDIInstantatior(this, beanManager);
    }
}

When doing UI.getCurrent().navigate(DefaultView.class, param); (DefaultView is in routes, I checked in the debugger):

com.vaadin.flow.router.NotFoundException: No route found for given navigation target!

	at com.vaadin.flow.router.RouteConfiguration.getUrlForTarget(RouteConfiguration.java:522)
	at com.vaadin.flow.router.RouteConfiguration.getUrl(RouteConfiguration.java:476)
	at com.vaadin.flow.router.RouteConfiguration.getUrl(RouteConfiguration.java:450)
	at com.vaadin.flow.component.UI.navigate(UI.java:865)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingquestionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions