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

[BUG]Signer information SecurityException when building executable with gradle nativeCompile #694

Open
joedayz opened this issue Feb 19, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@joedayz
Copy link

joedayz commented Feb 19, 2025

Describe the bug
I am using the gradle native image build configuration.

bootRun {
jvmArgs = [
'-Djava.security.properties=src/main/resources/custom.security'
]
}

bootBuildImage {
builder = 'paketobuildpacks/builder:tiny'
environment = [
'BP_NATIVE_IMAGE_BUILD_ARGUMENTS': ' -H:+AddAllCharsets -Djava.security.properties=/workspace/BOOT-INF/classes/custom.security --initialize-at-build-time=org.slf4j.helpers.Reporter'
]
}

graalvmNative {
binaries.all {
buildArgs.add('--exact-reachability-metadata')
buildArgs.add('-Djava.security.properties=src/main/resources/custom.security')
buildArgs.add('--initialize-at-build-time=org.slf4j.helpers.Reporter')
buildArgs.add('-H:+AddAllCharsets')
runtimeArgs.add('-XX:MissingRegistrationReportingMode=Warn')
}
}

To Reproduce

This is my Repo DemoNativeGraalVM

Steps to reproduce the behavior:```xml

```bash
$ ./step1.sh

Expected behavior

Caused by: java.lang.SecurityException: class "com.azure.spring.cloud.autoconfigure.implementation.storage.AzureStorageConfiguration$$SpringCGLIB$$0"'s signer information does not match signer information of other classes in the same package

Logs
Add logs to help explain your problem.
Please use backticks to properly format big logs. Example:

```
> Task :nativeCompile
[native-image-plugin] GraalVM Toolchain detection is disabled
[native-image-plugin] GraalVM location read from environment variable: JAVA_HOME
[native-image-plugin] Native Image executable path: /home/ubuntu/.sdkman/candidates/java/23.0.2-graal/lib/svm/bin/native-image
Warning: Using a deprecated option --report-unsupported-elements-at-runtime from 'META-INF/native-image/com.pacifico/demopacificogradle/native-image.properties' in 'file:///home/ubuntu/DemoNativeGraalVM/build/resources/aot/'. The option is deprecated and will be removed in the future. The use of unsupported elements is always reported at run time.
Warning: The option '-H:ServiceLoaderFeatureExcludeServices=org.hibernate.bytecode.spi.BytecodeProvider' is experimental and must be enabled via '-H:+UnlockExperimentalVMOptions' in the future.
Warning: Please re-evaluate whether any experimental option is required, and either remove or unlock it. The build output lists all active experimental options, including where they come from and possible alternatives. If you think an experimental option should be considered as stable, please file an issue.
Warning: Option 'DynamicProxyConfigurationResources' is deprecated and might be removed in a future release: This can be caused by a proxy-config.json file in your META-INF directory. Consider including proxy configuration in the reflection section of reachability-metadata.md instead.. Please refer to the GraalVM release notes.
Warning: Option 'DynamicProxyConfigurationResources' is deprecated and might be removed in a future release: This can be caused by a proxy-config.json file in your META-INF directory. Consider including proxy configuration in the reflection section of reachability-metadata.md instead.. Please refer to the GraalVM release notes.
========================================================================================================================
GraalVM Native Image: Generating 'demopacificogradle' (executable)...
========================================================================================================================
For detailed information and explanations on the build output, visit:
https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md
------------------------------------------------------------------------------------------------------------------------

[1/8] Initializing...                                                                                    (0.0s @ 0.24GB)
------------------------------------------------------------------------------------------------------------------------
                        0.6s (9.1% of total time) in 22 GCs | Peak RSS: 0.95GB | CPU load: 4.77
------------------------------------------------------------------------------------------------------------------------
Build artifacts:
 /home/ubuntu/DemoNativeGraalVM/build/native/nativeCompile/svm_err_b_20250219T133532.517_pid847366.md (build_info)
========================================================================================================================
Failed generating 'demopacificogradle' after 5.3s.

The build process encountered an unexpected error:

com.oracle.svm.core.util.VMError$HostedError: InternalFeature defined by com.oracle.svm.hosted.reflect.ReflectionFeature unexpectedly failed with a(n) java.lang.SecurityException
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.shouldNotReachHere(VMError.java:86)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.handleFeatureError(FeatureHandler.java:297)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:95)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:1043)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:590)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:554)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:528)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:711)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:139)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:94)
Caused by: java.lang.SecurityException: class "com.azure.spring.cloud.autoconfigure.implementation.storage.AzureStorageConfiguration$$SpringCGLIB$$0"'s signer information does not match signer information of other classes in the same package
        at java.base/java.lang.ClassLoader.checkCerts(ClassLoader.java:1171)
        at java.base/java.lang.ClassLoader.preDefineClass(ClassLoader.java:918)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1024)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageClassLoader.defineClass(NativeImageClassLoader.java:490)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageClassLoader.findClassViaClassPath(NativeImageClassLoader.java:442)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageClassLoader.loadClass(NativeImageClassLoader.java:629)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:528)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:578)
        at java.base/java.lang.Class.forName(Class.java:557)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ImageClassLoader.forName(ImageClassLoader.java:301)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ImageClassLoader.forName(ImageClassLoader.java:297)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ImageClassLoader.findClass(ImageClassLoader.java:290)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.config.RegistryAdapter.resolveNamedType(RegistryAdapter.java:96)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.config.RegistryAdapter.resolveType(RegistryAdapter.java:78)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.config.ReflectionRegistryAdapter.resolveType(ReflectionRegistryAdapter.java:60)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.config.ReflectionRegistryAdapter.resolveType(ReflectionRegistryAdapter.java:40)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.configure.LegacyReflectionConfigurationParser.parseClass(LegacyReflectionConfigurationParser.java:86)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.configure.ReflectionConfigurationParser.parseClassArray(ReflectionConfigurationParser.java:71)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.configure.LegacyReflectionConfigurationParser.parseAndRegister(LegacyReflectionConfigurationParser.java:56)
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.configure.ConfigurationParser.parseAndRegister(ConfigurationParser.java:90)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.config.ConfigurationParserUtils.doParseAndRegister(ConfigurationParserUtils.java:145)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.config.ConfigurationParserUtils.lambda$parseAndRegisterConfigurations$2(ConfigurationParserUtils.java:131)
        at java.base/java.util.stream.ReferencePipeline$4$1.accept(ReferencePipeline.java:232)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.config.ConfigurationParserUtils$1.tryAdvance(ConfigurationParserUtils.java:124)
        at java.base/java.util.Spliterator.forEachRemaining(Spliterator.java:332)
        at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:807)
        at java.base/java.util.stream.ReferencePipeline$7$1FlatMap.accept(ReferencePipeline.java:294)
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1709)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:570)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:560)
        at java.base/java.util.stream.StreamSpliterators$WrappingSpliterator.forEachRemaining(StreamSpliterators.java:315)
        at java.base/java.util.stream.Streams$ConcatSpliterator.forEachRemaining(Streams.java:734)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:570)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:560)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265)
        at java.base/java.util.stream.IntPipeline.reduce(IntPipeline.java:518)
        at java.base/java.util.stream.IntPipeline.sum(IntPipeline.java:476)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.config.ConfigurationParserUtils.parseAndRegisterConfigurations(ConfigurationParserUtils.java:133)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.config.ConfigurationParserUtils.parseAndRegisterConfigurations(ConfigurationParserUtils.java:85)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.reflect.ReflectionFeature.duringSetup(ReflectionFeature.java:287)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$setupNativeImage$17(NativeImageGenerator.java:1043)
        at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:93)
        ... 7 more


> Task :nativeCompile FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':nativeCompile'.
> Process 'command '/home/ubuntu/.sdkman/candidates/java/current/bin/native-image'' finished with non-zero exit value 1

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 7s<log content> 
```

System Info (please complete the following information):

  • OS: Linux instance-ubuntu 6.8.0-1018-oracle Gradle plugin : add a Kotlin DSL example and document it #19~22.04.1-Ubuntu SMP Mon Dec 9 23:57:57 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
  • GraalVM Version : java version "23.0.2" 2025-01-21
    Java(TM) SE Runtime Environment Oracle GraalVM 23.0.2+7.1 (build 23.0.2+7-jvmci-b01)
    Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 23.0.2+7.1 (build 23.0.2+7-jvmci-b01, mixed mode, sharing)
  • Java Version : 17
  • Plugin version : id 'org.graalvm.buildtools.native' version '0.10.5'

Additional context
The project works with: gradle bootRun and gradle bootBuildImage but fail with ./gradlew nativeCompile.

Thanks in advance

Jose

@joedayz joedayz added the bug Something isn't working label Feb 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant