Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue upgrading graalvm native image from 22.3.0 to 23.0.1 #7248

Closed
arvindkrishnakumar-okta opened this issue Aug 22, 2023 · 11 comments
Closed
Assignees

Comments

@arvindkrishnakumar-okta
Copy link

arvindkrishnakumar-okta commented Aug 22, 2023

Describe the issue

On upgrading my project from 22.3.0 to 23.0.1 of org.graalvm.nativeimage:svm (okta/okta-cli#455), I see the following build error:

Fatal error: java.lang.IllegalAccessError: superinterface check failed: class com.oracle.svm.core.posix.PosixSubstrateSigprofHandler_OptionDescriptors (in unnamed module @0x2145b572) cannot access class org.graalvm.compiler.options.OptionDescriptors (in module jdk.internal.vm.compiler) because module jdk.internal.vm.compiler does not export org.graalvm.compiler.options to unnamed module @0x2145b572
	at java.base/java.lang.ClassLoader.defineClass1(Native Method)
	at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
	at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
	at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:524)
	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:427)
	at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:421)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:420)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
	at java.base/jdk.internal.loader.Loader.loadClass(Loader.java:564)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:467)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1217)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1228)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
	at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
	at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
	at org.graalvm.nativeimage.base/com.oracle.svm.common.option.CommonOptionParser.collectOptions(CommonOptionParser.java:168)
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.option.SubstrateOptionsParser.collectOptions(SubstrateOptionsParser.java:116)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.option.HostedOptionParser.collectOptions(HostedOptionParser.java:63)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.option.HostedOptionParser.<init>(HostedOptionParser.java:58)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageClassLoaderSupport.setupHostedOptionParser(NativeImageClassLoaderSupport.java:186)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.installNativeImageClassLoader(NativeImageGeneratorRunner.java:181)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:123)
Error: Image build request failed with exit status 1

Steps to reproduce the issue

Describe GraalVM and your environment

GraalVM Version: 22.3.0
Java version: 17.0.8, vendor: GraalVM Community, runtime: /opt/hostedtoolcache/graalvm-ce-java17-linux/22.3.3/x64/graalvm-ce-java17-22.3.3
OS name:

  • "linux", version: "5.15.0-1041-azure", arch: "amd64", family: "unix"
  • "mac os x", version: "12.6.7", arch: "x86_64", family: "mac"
  • "windows server 2019", version: "10.0", arch: "amd64", family: "windows"

More details

okta/okta-cli#455

image

image

@oubidar-Abderrahim
Copy link
Member

oubidar-Abderrahim commented Aug 25, 2023

Thank you for reaching out about this issue, you can either set export USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM=false to disable the module system in the native builder or add-exports for the required modules. For the above case, that would be --add-exports=jdk.internal.vm.compiler/org.graalvm.compiler.options=ALL-UNNAMED

@oubidar-Abderrahim oubidar-Abderrahim self-assigned this Aug 25, 2023
@arvindkrishnakumar-okta
Copy link
Author

arvindkrishnakumar-okta commented Aug 25, 2023

@oubidar-Abderrahim Thanks!

I tried setting env variable USE_NATIVE_IMAGE_JAVA_PLATFORM_MODULE_SYSTEM: false (see here) like you suggested above and now landed in a new error:

Fatal error: java.lang.NoSuchMethodError: 'com.oracle.svm.core.option.LocatableMultiOptionValue$Strings com.oracle.svm.core.option.LocatableMultiOptionValue$Strings.build()'
	at com.oracle.svm.graal.hosted.RuntimeCompilationFeature$Options.<clinit>(RuntimeCompilationFeature.java:137)
	at com.oracle.svm.graal.hosted.RuntimeCompilationFeature_OptionDescriptors.get(RuntimeCompilationFeature_OptionDescriptors.java:17)
	at com.oracle.svm.graal.hosted.RuntimeCompilationFeature_OptionDescriptors$1.next(RuntimeCompilationFeature_OptionDescriptors.java:80)
	at com.oracle.svm.graal.hosted.RuntimeCompilationFeature_OptionDescriptors$1.next(RuntimeCompilationFeature_OptionDescriptors.java:71)
	at com.oracle.svm.common.option.CommonOptionParser.collectOptions(CommonOptionParser.java:169)
	at com.oracle.svm.core.option.SubstrateOptionsParser.collectOptions(SubstrateOptionsParser.java:116)
	at com.oracle.svm.hosted.option.HostedOptionParser.collectOptions(HostedOptionParser.java:63)
	at com.oracle.svm.hosted.option.HostedOptionParser.<init>(HostedOptionParser.java:58)
	at com.oracle.svm.hosted.NativeImageClassLoaderSupport.setupHostedOptionParser(NativeImageClassLoaderSupport.java:186)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.installNativeImageClassLoader(NativeImageGeneratorRunner.java:181)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:123)
	at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:610)
Error: Image build request failed with exit status 1

@arvindkrishnakumar-okta
Copy link
Author

@oubidar-Abderrahim can you please help?

@oubidar-Abderrahim
Copy link
Member

Do you generate config files using the Tracing agent? If you don't, please make sure to do so.

@arvindkrishnakumar-okta
Copy link
Author

arvindkrishnakumar-okta commented Sep 19, 2023

@oubidar-Abderrahim No, I don't use Tracing agent in my project.

@oubidar-Abderrahim
Copy link
Member

Native image requires specific configuration regarding reflection, resources, JNI... The usage of the Tracing agent is highly recommended to help generate this config, otherwise, you'll have to manually add this configuration.

@oubidar-Abderrahim
Copy link
Member

any updates after using the tracing agent?

@oubidar-Abderrahim
Copy link
Member

Closing for inactivity

@the-foreigner
Copy link

Hi @oubidar-Abderrahim it happens when

<dependency>
    <groupId>org.graalvm.compiler</groupId>
    <artifactId>compiler</artifactId>
    <version>23.0.1</version>
</dependency>

is on the classpath. I add --add-exports still error. What do you suggest?

native-image -cp compiler-23.0.1.jar Main --add-exports=jdk.internal.vm.compiler/org.graalvm.compiler.options=ALL-UNNAMED
Fatal error: java.lang.IllegalAccessError: superinterface check failed: class org.graalvm.compiler.phases.common.NodeCounterPhase_OptionDescriptors (in unnamed module @0x47542153) cannot access class org.graalvm.compiler.options.OptionDescriptors (in module jdk.internal.vm.compiler) because module jdk.internal.vm.compiler does not export org.graalvm.compiler.options to unnamed module @0x47542153
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageClassLoader.defineClass(NativeImageClassLoader.java:500)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageClassLoader.findClassViaClassPath(NativeImageClassLoader.java:452)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageClassLoader.loadClass(NativeImageClassLoader.java:640)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:534)
        at java.base/java.lang.Class.forName(Class.java:513)
        at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1217)
        at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1228)
        at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
        at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
        at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
        at org.graalvm.nativeimage.base/com.oracle.svm.common.option.CommonOptionParser.collectOptions(CommonOptionParser.java:171)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.option.SubstrateOptionsParser.collectOptions(SubstrateOptionsParser.java:118)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.option.HostedOptionParser.collectOptions(HostedOptionParser.java:66)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.option.HostedOptionParser.<init>(HostedOptionParser.java:61)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageClassLoaderSupport.setupHostedOptionParser(NativeImageClassLoaderSupport.java:218)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.installNativeImageClassLoader(NativeImageGeneratorRunner.java:275)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:132)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:97)

@niyid
Copy link

niyid commented Jul 7, 2024

Do you generate config files using the Tracing agent? If you don't, please make sure to do so.

Hello,

Please can you give an example of how to setup the Tracing Agent with Gradle

@djha-skin
Copy link

djha-skin commented Oct 26, 2024

Hello,

I am using the tracing agent in my project, and I have used --add-export as well. However, I am still getting the very same error as above. I am using the latest GraalVM stack for the OpenJDK version 21; That is, I am using GraalVM CE for OpenJDK21.

I feel that this is still a pretty big issue. I would love to help in any way I can. Is there some output you would like to see perhaps?

To reproduce this error, you may do the following:

  1. Ensure the GraalVM CE 21.0.2 is installed.
  2. Set JAVA_HOME and GRAALVM_HOME to the graalvm folder.
  3. go to https://github.com/djha-skin/degasolv and clone it out.
  4. Check out the develop branch.
  5. Go into the git repo directory.
  6. Create a folder, target.
  7. Create another folder inside target called uberjar.
  8. Drop this jar file into that folder (target/uberjar relative to the git repo directory)
  9. From the root git repo folder, run the script ./reproduce-error

In the aforementioned script you may find where the trace agent is used, and also the actual native-image call I use.

For completeness, here is that error that I get, so that you may know it is the same:

Fatal error: java.lang.IllegalAccessError: superinterface check failed: class org.graalvm.compiler.hotspot.meta.HotSpotNodePlugin_OptionDescriptors (in unnamed module @0x5cee5251) cannot access class org.graalvm.compiler.options.OptionDescriptors (in module jdk.internal.vm.compiler) because module jdk.internal.vm.compiler does not export org.graalvm.compiler.options to unnamed module @0x5cee5251
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1027)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageClassLoader.defineClass(NativeImageClassLoader.java:500)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageClassLoader.findClassViaClassPath(NativeImageClassLoader.java:452)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageClassLoader.loadClass(NativeImageClassLoader.java:640)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:534)
        at java.base/java.lang.Class.forName(Class.java:513)
        at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1217)
        at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1228)
        at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
        at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
        at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
        at org.graalvm.nativeimage.base/com.oracle.svm.common.option.CommonOptionParser.collectOptions(CommonOptionParser.java:171)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.option.SubstrateOptionsParser.collectOptions(SubstrateOptionsParser.java:118)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.option.HostedOptionParser.collectOptions(HostedOptionParser.java:66)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.option.HostedOptionParser.<init>(HostedOptionParser.java:61)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageClassLoaderSupport.setupHostedOptionParser(NativeImageClassLoaderSupport.java:218)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.installNativeImageClassLoader(NativeImageGeneratorRunner.java:276)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:133)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:98)
com.oracle.svm.driver.NativeImage$NativeImageError
        at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.showError(NativeImage.java:2337)
        at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.build(NativeImage.java:1914)
        at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.performBuild(NativeImage.java:1873)
        at org.graalvm.nativeimage.driver/com.oracle.svm.driver.NativeImage.main(NativeImage.java:1847)
        at java.base@21.0.2/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

Thanks for your help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants