Trava dcevm-11 - Hotswap successfully adds new routes but fails to update t

When I add a new view, it is detected and added. When I try to edit an existing view, it fails because of a non-unique exception.

I was looking at this guide for inspiration https://vaadin.com/blog/developing-without-server-restarts and the newest comment about being able to skip the -XXaltjvm and -javaagent steps but I think almost all of the steps might not be needed anymore?

The only configurations I made was pointing the maven JRE to dcevm-11.0.1+8.

Then I add the TestView route and it logs fine and the new route exist with expected content:

HOTSWAP AGENT: 00:35:33.865 INFO (org.hotswap.agent.plugin.vaadin.VaadinPlugin) - HotSwapAgent dynamically added new route to com.example.test.spring.TestView

Then I do something small like change the value of the text inside a label in that new view and I get:

HOTSWAP AGENT: 00:35:54.597 INFO (org.hotswap.agent.plugin.vaadin.VaadinPlugin) - HotSwapAgent dynamically added new route to com.example.test.spring.TestView
HOTSWAP AGENT: 00:35:54.599 ERROR (org.hotswap.agent.plugin.vaadin.VaadinPlugin) - null
java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.hotswap.agent.plugin.vaadin.VaadinPlugin.addToRouterConfiguration(VaadinPlugin.java:234)
	at org.hotswap.agent.plugin.vaadin.VaadinPlugin.addNewRoute(VaadinPlugin.java:157)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.hotswap.agent.annotation.handler.WatchEventCommand.onWatchEvent(WatchEventCommand.java:190)
	at org.hotswap.agent.annotation.handler.WatchEventCommand.executeCommand(WatchEventCommand.java:98)
	at org.hotswap.agent.command.impl.CommandExecutor.run(CommandExecutor.java:43)
Caused by: com.vaadin.flow.server.AmbiguousRouteConfigurationException: Navigation targets must have unique routes, found navigation targets 'com.example.test.spring.TestView' and 'com.example.test.spring.TestView' with the same route.
	at com.vaadin.flow.server.startup.RouteTarget.validateNormalTarget(RouteTarget.java:163)
	at com.vaadin.flow.server.startup.RouteTarget.addTargetByType(RouteTarget.java:107)
	at com.vaadin.flow.server.startup.RouteTarget.addRoute(RouteTarget.java:100)
	at com.vaadin.flow.router.internal.ConfigureRoutes.setRoute(ConfigureRoutes.java:133)
	at com.vaadin.flow.router.internal.AbstractRouteRegistry.addRouteToConfiguration(AbstractRouteRegistry.java:366)
	at com.vaadin.flow.router.internal.AbstractRouteRegistry.lambda$setRoute$83b15968$1(AbstractRouteRegistry.java:308)
	at com.vaadin.flow.router.internal.AbstractRouteRegistry.configure(AbstractRouteRegistry.java:95)
	at com.vaadin.flow.router.internal.AbstractRouteRegistry.setRoute(AbstractRouteRegistry.java:307)
	at com.vaadin.flow.server.startup.ApplicationRouteRegistry.setRoute(ApplicationRouteRegistry.java:233)
	at com.vaadin.flow.router.RouteConfiguration.setAnnotatedRoute(RouteConfiguration.java:225)
	... 13 more

I’m not sure if anyone else is experiencing this?

Yes I’m actually getting the same experience you’re describing as I was following the inspiration https://vaadin.com/blog/developing-without-server-restarts as well.

I was hoping to find a solution to resolve.

I am also getting the same result, I think it has to do with sessions that are open keeping the object in memory (or something like that). I get the modified code if I log out then back in to the application.

Searching the interwebs I came on this post; I get a “Update route” message when a class is changed (and I assume reloaded), no exceptions, but nothing happens in the browser. Restarting the browser (so creating a new session) does not help.

I’m using this technique because I’m using an embedded jetty 9.4.32.v20200930 to deploy the Vaadin 14.4.0 webapp as an independent executable. So not using the maven-plugin (https://vaadin.com/learn/tutorials/embedded-jetty-server-in-vaadin-flow).

Has anyone solved this in they year since the original post?