hilla icon indicating copy to clipboard operation
hilla copied to clipboard

Exception from Hotswapper

Open Artur- opened this issue 11 months ago • 2 comments

Describe the bug

In a Copilot test, we see the following on startup

HOTSWAP AGENT: 07:39:01.830 ERROR (org.hotswap.agent.command.ReflectionCommand) - Error executin method onHotswap in class com.vaadin.flow.hotswap.Hotswapper
java.lang.reflect.InvocationTargetException
	at jdk.internal.reflect.GeneratedMethodAccessor32.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at org.hotswap.agent.command.ReflectionCommand.doExecuteReflectionCommand(ReflectionCommand.java:207)
	at org.hotswap.agent.command.ReflectionCommand.executeCommand(ReflectionCommand.java:[168]
	at org.hotswap.agent.command.impl.CommandExecutor.run(CommandExecutor.java:43)
Caused by: java.lang.UnsatisfiedLinkError: Unable to load library 'Carbon':
libCarbon.so: cannot open shared object file: No such file or directory
libCarbon.so: cannot open shared object file: No such file or directory
Native library (linux-x86-64/libCarbon.so) not found in resource path
...
	at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:325)
	at com.sun.jna.NativeLibrary.getInstance(NativeLibrary.java:481)
	at com.sun.jna.Library$Handler.<init>(Library.java:197)
	at com.sun.jna.Native.loadLibrary(Native.java:668)
	at com.sun.jna.Native.loadLibrary(Native.java:652)
	at io.methvin.watchservice.jna.CarbonAPI.<clinit>(CarbonAPI.java:20)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:375)
	at com.vaadin.hilla.Hotswapper.affectsEndpoints(Hotswapper.java:127)
	at com.vaadin.hilla.Hotswapper.onHotswap(Hotswapper.java:49)
	at com.vaadin.hilla.Hotswapper.onClassLoadEvent(Hotswapper.java:27)
	at com.vaadin.flow.hotswap.Hotswapper.onHotswapInternal(Hotswapper.java:236)
	at com.vaadin.flow.hotswap.Hotswapper.onHotswap(Hotswapper.java:145)
	... 6 more
	Suppressed: java.lang.UnsatisfiedLinkError: libCarbon.so: cannot open shared object file: No such file or directory
		at com.sun.jna.Native.open(Native Method)
		at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:213)
		... 18 more
	Suppressed: java.lang.UnsatisfiedLinkError: libCarbon.so: cannot open shared object file: No such file or directory
		at com.sun.jna.Native.open(Native Method)
		at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:226)
		... 18 more
	Suppressed: java.io.IOException: Native library (linux-x86-64/libCarbon.so) not found in resource path ...
		at com.sun.jna.Native.extractFromResourcePath(Native.java:1141)
		at com.sun.jna.NativeLibrary.loadLibrary(NativeLibrary.java:297)
		... 18 more

This seems to originate in https://github.com/vaadin/hilla/blob/0a9bd31533cbc061baa3b0153f9b95cc9a531161/packages/java/endpoint/src/main/java/com/vaadin/hilla/Hotswapper.java#L127 where Hilla tries to load all classes that are reported by HotswapAgent

Expected-behavior

No exceptions

Reproduction

Use io.methvin.watcher.DirectoryWatcher in the app and run it on linux or windows

System Info

Vaadin 24.6 alpha3

Artur- avatar Nov 19 '24 07:11 Artur-