Open wangzhongshan opened 4 years ago
Hi, thanks for reporting this. I'm able to reproduce the issue you reported. I'll investigate more about it and report back.
any progress on this?I have the same issue.
Does it even make sense to have JRT support in a native image? Why would it have that filesystem at run time?
the code simply calls a groovy script , which calls println, then triggers the exception stack ....
Does it even make sense to have JRT support in a native image? Why would it have that filesystem at run time?
In my case it is necessary to use BCEL's SyntheticRepository
class. This class try to parse CLASSPATH
which is created based on java.home
property, and throw the exception like below:
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:315)
at org.apache.bcel.util.SyntheticRepository.getInstance(SyntheticRepository.java:44)
at org.apache.bcel.Repository.<clinit>(Repository.java:37)
(omit)
Caused by: java.nio.file.ProviderNotFoundException: Provider "jrt" not found
at java.nio.file.FileSystems.getFileSystem(FileSystems.java:234)
at org.apache.bcel.util.ModularRuntimeImage.<init>(ModularRuntimeImage.java:58)
at org.apache.bcel.util.ClassPath$JrtModules.<init>(ClassPath.java:356)
at org.apache.bcel.util.ClassPath.<init>(ClassPath.java:569)
at org.apache.bcel.util.ClassPath.<clinit>(ClassPath.java:443)
at com.oracle.svm.core.classinitialization.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:375)
at com.oracle.svm.core.classinitialization.ClassInitializationInfo.initialize(ClassInitializationInfo.java:295)
... 21 more
My motivation to use BCEL is accelerate static bytecode analysis.
Pass -H:+AllowJRTFileSystem
. Note that you won't be able to inspect modules within the native executable, but you can open and inspect other modules e.g. you still need to have the jmods around.
Thanks, I've tried the option, and faced another UnsatisfiedLinkError
in the same constructor. java.home
is pointing the home of GraalVM v21.1.0 (Java 11). I'll keep investigating on this issue.
Exception in thread "main" java.lang.UnsatisfiedLinkError: jdk.internal.jimage.NativeImageBuffer.getNativeMap(Ljava/lang/String;)Ljava/nio/ByteBuffer; [symbol: Java_jdk_internal_jimage_NativeImageBuffer_getNativeMap or Java_jdk_internal_jimage_NativeImageBuffer_getNativeMap__Ljava_lang_String_2]
at com.oracle.svm.jni.access.JNINativeLinkage.getOrFindEntryPoint(JNINativeLinkage.java:153)
at com.oracle.svm.jni.JNIGeneratedMethodSupport.nativeCallAddress(JNIGeneratedMethodSupport.java:57)
at jdk.internal.jimage.NativeImageBuffer.getNativeMap(NativeImageBuffer.java)
at jdk.internal.jimage.BasicImageReader.<init>(BasicImageReader.java:95)
at jdk.internal.jimage.ImageReader$SharedImageReader.<init>(ImageReader.java:224)
at jdk.internal.jimage.ImageReader$SharedImageReader.open(ImageReader.java:238)
at jdk.internal.jimage.ImageReader.open(ImageReader.java:67)
at jdk.internal.jimage.ImageReader.open(ImageReader.java:71)
at jdk.internal.jrtfs.SystemImage.open(SystemImage.java:59)
at jdk.internal.jrtfs.JrtFileSystem.<init>(JrtFileSystem.java:90)
at jdk.internal.jrtfs.JrtFileSystemProvider.getTheFileSystem(JrtFileSystemProvider.java:207)
at jdk.internal.jrtfs.JrtFileSystemProvider.getFileSystem(JrtFileSystemProvider.java:221)
at java.nio.file.FileSystems.getFileSystem(FileSystems.java:231)
at org.apache.bcel.util.ModularRuntimeImage.<init>(ModularRuntimeImage.java:58)
at org.apache.bcel.util.ClassPath$JrtModules.<init>(ClassPath.java:356)
at org.apache.bcel.util.ClassPath.<init>(ClassPath.java:569)
@KengoTODA Have you found any solution for that UnsatisfiedLinkError? Because i got the same using jboss Path Utils
Yes, it is working with GraalVM 22.0.0.2. My repo is https://github.com/KengoTODA/spotbugs-cli, not sure if it helps you or not tho.
I have also encountered the same problem. Is there a feasible solution?
Describe the issue
java.nio.file.ProviderNotFoundException: Provider "jrt" not found when run groovy code in java
Steps to reproduce the issue Please include both build steps as well as run steps
Describe GraalVM and your environment:
More details