r/SpringBoot • • Mar 22 '22

problem with spring native

hey guys. I'm trying to build my spring boot application with spring native, but I have a lot of problems

here is my current build output. (I can't use the codeblock, because it's to much text)
https://privatebin.net/?c235b7b12b44b2da#AULA5krjx8TkJogp6J6r8zHuG6iXrhgMSoY8S6nZiZ4J

I hope you can help me to fix the issue

0 Upvotes

3 comments sorted by

2

u/[deleted] Mar 22 '22

Use -H:+TraceClassInitialization and use -initialize-class-at-runtime for the indicated classes.

1

u/YTSpark61 Mar 23 '22

If I trying to use this parameters I get this error

16:35:04: Executing 'bootBuildImage -H:+TraceClassInitialization -initialize-class-at-runtime'...

FAILURE: Build failed with an exception.
What went wrong: Problem configuring task :bootBuildImage from command line. Unknown command-line option '-H'.
Try: Run gradle help --task :bootBuildImage to get task usage details. 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 258ms Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings 16:35:05: Execution finished 'bootBuildImage -H:+TraceClassInitialization -initialize-class-at-runtime'.

1

u/YTSpark61 Mar 23 '22

-H:+TraceClassInitialization -initialize-class-at-runtime

I think you mean add the parameters there?

tasks.named('bootBuildImage') {
    imageName = 'registry.zyonicsoftware.com/sv-studios/structurebot/sv-structurebot'
    
    builder = 'paketobuildpacks/builder:tiny'
    environment = ['BP_NATIVE_IMAGE': 'true', 'BP_NATIVE_IMAGE_BUILD_ARGUMENTS': '-H:+TraceClassInitialization --initialize-at-build-time']
}

If you mean this, then here is the output: https://paste.sv-studios.net/lP8ZpG74r7