question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

GraalVM native-image build error

See original GitHub issue

Building example https://github.com/micronaut-projects/micronaut-data/tree/master/examples/example-jpa with native-image produces binary (seems working) but shows errors.

Steps to Reproduce

  1. Checkout https://github.com/micronaut-projects/micronaut-data/tree/master/examples/example-jpa
  2. run ./gradlew assemble
  3. run native-image --no-server -cp build/libs/example-jpa-0.1-all.jar

Expected Behaviour

Binary is produced and no errors are reported.

Actual Behaviour

Binary is produced and below errors are reported:

Error: Classes that should be initialized at run time got initialized during image building:
 org.jboss.logging.Slf4jLocationAwareLogger was unintentionally initialized at build time. To see why org.jboss.logging.Slf4jLocationAwareLogger got initialized use -H:+TraceClassInitialization
org.jboss.logging.Logger was unintentionally initialized at build time. To see why org.jboss.logging.Logger got initialized use -H:+TraceClassInitialization
org.hibernate.internal.CoreMessageLogger_$logger was unintentionally initialized at build time. To see why org.hibernate.internal.CoreMessageLogger_$logger got initialized use -H:+TraceClassInitialization
org.jboss.logging.LoggerProviders was unintentionally initialized at build time. To see why org.jboss.logging.LoggerProviders got initialized use -H:+TraceClassInitialization
org.jboss.logging.LoggingLocale was unintentionally initialized at build time. To see why org.jboss.logging.LoggingLocale got initialized use -H:+TraceClassInitialization
org.jboss.logging.DelegatingBasicLogger was unintentionally initialized at build time. To see why org.jboss.logging.DelegatingBasicLogger got initialized use -H:+TraceClassInitialization

Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Error: Image build request failed with exit status 1

Environment Information

  • Operating System: Linux Fedora
  • Micronaut Version: 1.2.9
  • JDK Version:
openjdk version "1.8.0_242"
OpenJDK Runtime Environment (build 1.8.0_242-b06)
OpenJDK 64-Bit GraalVM CE 19.3.1 (build 25.242-b06-jvmci-19.3-b07, mixed mode)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
graemerochercommented, Mar 18, 2020

Fixed using the snapshots, as a workaround you can add the following flags:

--initialize-at-build-time=org.jboss.logging,org.hibernate.internal,org.hibernate.jmx,org.hibernate.query

And also add com.zaxxer.hikari.util.ConcurrentBag$IConcurrentBagEntry[] in the @TypeHint annotation in Application.java.

0reactions
Uniqencommented, Feb 29, 2020

@morki I recommend looking at https://github.com/micronaut-graal-tests/micronaut-data-jpa-graal/tree/h2 . Basically the same example but working with GraalVM.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix GraalVM Native Image Build Issues - Simply-How.com
One of the most common problems when building native images are out of memory errors: Error: Image build request failed with exit status...
Read more >
[GR-36396] Unable to build native image in GraalVM 22.1.0-dev
Describe the issue I'm unable to build a native image of a Java application with native-image from GraalVM CE 22.1.0-dev (build ...
Read more >
Building a Native Executable - Quarkus
(Only for Oracle GraalVM CE/EE) Install the native-image tool using gu install : ... This means that you may see the following error...
Read more >
Native Image - GraalVM
The Native Image builder or native-image is a utility that processes all classes of an application and their dependencies, including those from the...
Read more >
Error building native image with gluonfx-maven-plugin 1.0.14
I'm trying to build a native image using: GraalVM: 22.2.0. GluonFx maven Plugin: 1.0.14. And I get the following error:
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found