Upgrade from 14.2 to 16: NoSuchMethodException ApplicationRouteRegistry.get

I’m trying to upgrade our project from 14.2 to 16 and I get the following error when starting up the application:

java.lang.NoSuchMethodException: com.vaadin.flow.server.startup.ApplicationRouteRegistry.getInstance(javax.servlet.ServletContext)

Any idea what is causing this? To my knowledge I don’t use any of the deprecated methods.
The application does seem to work, but I still think I shouldn’t be getting this error…

(Note: I get the same error when trying this with 15.0.2)

Hi,

Do you have more context from the server startup log to show the underlying cause of the exception? Are you by any means using HotswapAgent (e.g. via Trava JDK) or JRebel? If so, make sure to upgrade to recent versions since there have been changes in internal routing architecture affecting these tools.

Hi Johannes,

Many thanks for your answer!
I think you’re on to something. I first disabled Hotswap altogether and indeed the error disappeared.
I then upgraded hotswap-agent to the latest version, 1.4.1 (I was on 1.4.0 before) and tried again.

I now get a different error:

HOTSWAP AGENT: 21:07:52.265 INFO (org.hotswap.agent.config.PluginRegistry) - Plugin 'org.hotswap.agent.plugin.vaadin.VaadinPlugin' initialized in ClassLoader 'sun.misc.Launcher$AppClassLoader@18b4aac2'.
HOTSWAP AGENT: 21:07:52.427 ERROR (org.hotswap.agent.command.ReflectionCommand) - Method servletInitialized not found in class org.hotswap.agent.plugin.vaadin.VaadinIntegration
java.lang.NoSuchMethodException: org.hotswap.agent.plugin.vaadin.VaadinIntegration.servletInitialized(com.vaadin.flow.spring.SpringServlet)
	at java.lang.Class.getDeclaredMethod(Class.java:2130)
	at org.hotswap.agent.command.ReflectionCommand.doExecuteReflectionCommand(ReflectionCommand.java:205)
	at org.hotswap.agent.command.ReflectionCommand.executeCommand(ReflectionCommand.java:168)
	at org.hotswap.agent.command.impl.CommandExecutor.run(CommandExecutor.java:43)

Any further advice on this one?

Ok, thanks for the confirmation. This is fixed, but not in the latest HotswapAgent release yet. Until the next 1.4.1 release, a snapshot release of HotswapAgent should do the trick:

https://oss.sonatype.org/content/repositories/snapshots/org/hotswapagent/hotswap-agent/1.4.1-SNAPSHOT/

YES! That does the trick. I guess we’re really cutting edge here :wink:

The fix is now also in 1.4.1 release (GH https://github.com/HotswapProjects/HotswapAgent/releases/tag/RELEASE-1.4.1 and in Maven Central)

Excellent, thanks!