-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
Description
Describe the issue
Note: This is a reproduction of issue #2842 , as requested by @vjovanov. That issue had been marked as complete, but many users (including I) have continued to experience it -- so, vjovanov said: "to get this fixed it would be best to open a new ticket for this problem with a minimal reproducer".
Essentially, when attempting to load a class from the awt library in a native image, the titular exception occurs.
Steps to reproduce the issue
- Please check out the following project for a small, single-class repro of this error: reproduce-awt-lib-error-graal
- Run mvn clean install in the root directory of the project to build the jar
- Run mvn -Pnative package to build the native image, called test/repro-awt-lib-error
- Run docker run test/repro-awt-lib-error
Describe GraalVM and your environment:
- GraalVM version 23.0.2 (as determined by buildpack)
- JDK major version: 17
- OS: MacOS Sonoma 14.2.1
- Architecture: 6-Core Intel Core i9
- Maven version: 3.9.6
- Docker version: 24.0.7
More details
The output printed from my enviroment, finishing with the error stack trace, is as follows:
docker run test/repro-awt-lib-error:latest
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v3.1.0)
2024-01-29T16:02:51.618Z INFO 1 --- [ main] org.example.App : Starting AOT-processed App using Java 17.0.9 with PID 1 (/workspace/org.example.App started by cnb in /workspace)
2024-01-29T16:02:51.619Z INFO 1 --- [ main] org.example.App : No active profile set, falling back to 1 default profile: "default"
2024-01-29T16:02:51.625Z INFO 1 --- [ main] org.example.App : Started App in 0.014 seconds (process running for 0.017)
Exception in thread "main" java.lang.UnsatisfiedLinkError: no awt in java.library.path
at org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk.NativeLibrarySupport.loadLibraryRelative(NativeLibrarySupport.java:136)
at [email protected]/java.lang.ClassLoader.loadLibrary(ClassLoader.java:50)
at [email protected]/java.lang.Runtime.loadLibrary0(Runtime.java:818)
at [email protected]/java.lang.System.loadLibrary(System.java:1989)
at [email protected]/java.awt.image.ColorModel$1.run(ColorModel.java:210)
at [email protected]/java.awt.image.ColorModel$1.run(ColorModel.java:208)
at [email protected]/java.security.AccessController.executePrivileged(AccessController.java:173)
at [email protected]/java.security.AccessController.doPrivileged(AccessController.java:318)
at [email protected]/java.awt.image.ColorModel.loadLibraries(ColorModel.java:207)
at [email protected]/java.awt.image.ColorModel.<clinit>(ColorModel.java:220)
at [email protected]/java.awt.image.Raster.<clinit>(Raster.java:172)
at org.apache.pdfbox.pdmodel.PDDocument.<clinit>(PDDocument.java:107)
at org.example.App.main(App.java:17)
mipastgt, saugion, woj-tek, sureshg, leozhao9527 and 8 moresaugion, leozhao9527 and SidiBecker