Could not initialize class javax.imageio.ImageIO at PWARegistry

Hi,

Still trying to build a native image of my application.

Compiling is succesful now, but when I run it if get the following

java.lang.UnsatisfiedLinkError: no awt in java.library.path at org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk.NativeLibrarySupport.loadLibraryRelative(NativeLibrarySupport.java:136) ~[na:na]

A bit lower in the stacktrace I see the following NoClassDefFoundError:

java.lang.NoClassDefFoundError: Could not initialize class javax.imageio.ImageIO at com.vaadin.flow.server.PwaRegistry.getBaseImage(PwaRegistry.java:404) ~[na:na] at com.vaadin.flow.server.PwaRegistry.initializeResources(PwaRegistry.java:128)

This is coming from vaadin-flow-server:24.1.3.

Any ideas how I can fix this?

Kind regards,
Kristof.

Remove the PWA annotation.

Is your application using vaadin-spring? Hints for supporting PWA image creation in native build has recently been added.
In that case what operating system are you using to run the native build?

yes, it is.

I’m running the build on MacOS Ventura 13.4.1 on an M1 .

Reading up on the issue on Vaadin’s github. Looks indeed like a fix is coming, I’ll remove the PWA annotation for now, and test again on 24.2.0.

Thanks!

A fix was already release in Flow 24.1.1 and another one will be released in the upcoming 24.1.5
Anyway, based on the error you posted, it may be an issue in Graal VM