'Ambiguous route error in Vaadin 14 web application running on Tomcat
I am getting the following error when I deploy a Vaadin 14 web application on Tomcat 9.0.46
Caused by: com.vaadin.flow.server.AmbiguousRouteConfigurationException: Navigation targets must have unique routes, found navigation targets 'xx.SForceFindPaymentView' and 'xx.SForceFindPaymentView' with parameter have the same route.
The class is defined as follows:
@Route(value = "sf-find-payment", layout = MainLayout.class)
@PageTitle("Find Payment")
public class SForceFindPaymentView extends FindPaymentView implements HasUrlParameter<String>, IAAPConnection {
And the parent class is defined as follows:
@PageTitle("Find Payment")
@Route(value = "find-payment", layout = MainLayout.class)
public class FindPaymentView extends VerticalLayout implements HasUrlParameter<String>, IAAPConnection {
The only difference between the parent class and the derived class is the way the parameters are handled in the setParameter() method.
The setParameter method has the following signature
@Override
public void setParameter(final BeforeEvent event, @OptionalParameter final String parameter) {
The odd thing is if I delete the war and redeploy the exact same war file the problem goes away and the application installs successfully.
I tried removing the @OptionalParameter annotation but that made no difference. The error message seems to see two routes for the same class, one with a parameter and one without so I thought if I removed the @OptionalParameter in both the parent and derived class, that might help but it made no difference.
Grateful for any suggestions.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
