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.

Adding a reflection configuration file fails when building native using Docker

See original GitHub issue

We are currently trying to update an old 0.21.2 Quarkus Project to 0.28.1. In this project we used a reflect-config.json to keep classes from being deleted. With 0.21.2 we could successfully build a native image and a docker container, but now we can’t.

We already changed to quarkus.native.additional-build-args in the application.properties file with these parameters:

quarkus.native.additional-build-args=\
-H:ResourceConfigurationFiles=resources/main/resource-config.json,\
-H:ReflectionConfigurationFiles=resources/main/reflect-config.json

quarkus.native.enable-jni=true
quarkus.native.enable-http-url-handler=true
quarkus.native.enable-https-url-handler=true
quarkus.native.enable-all-security-services=true

Trying to execute the build ends in an error that he can’t find project/resources/main/reflect-config.json.

What Quarkus tries to execute is this: docker run -v /home/bfr/git/minical-multi/minical/build/minical-0.2.0-native-image-source-jar:/project:z --user 1000:1001 --rm quay.io/quarkus/ubi-quarkus-native-image:19.2.1 -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 -H:ResourceConfigurationFiles=resources/main/resource-config.json -H:ReflectionConfigurationFiles=resources/main/reflect-config.json --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime -jar minical-0.2.0-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http,https --enable-all-security-services -H:-SpawnIsolates -H:+JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace minical-0.2.0-runner

In the earlier versions of quarkus just the build directory was bound to docker as a volume and all files were found correctly, but now it is only the native-image-source-jar and we can’t figure out a way to get the reflect-config.json into it, because always on build the directory is new generated and deletes the already copied file.

The reflect-config.json itself is in the .jar file and can’t also be accessed. Is there a way to do it, like change the volume path for the docker run or any other way we oversaw?

We are using gradle to build our project.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:25 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
geoandcommented, Nov 15, 2019

@gastaldi you mean make users write an extension?

That is certainly possible an in this case easy to do, but I really think it’s not necessary and would be a lot more user friendly to just provide config options that would work for 95% of the use cases

0reactions
gastaldicommented, Oct 1, 2020

@spannozzo can you open a new ticket? With a reproducer too, if possible. Thank you

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build a Native Executable with Reflection - GraalVM
The following application demonstrates the use of Java reflection. Save the following source code in a file named ReflectionExample.java: import java.lang.
Read more >
Tips for writing native applications - Quarkus
Quarkus makes registration of reflection in an extension a breeze by using ReflectiveClassBuildItem , thus eliminating the need for a JSON configuration file....
Read more >
Quarkus Building a Native Executable NoSuchFileException ...
now the files are at root of my project., and i use <additionalBuildArg> -H:ReflectionConfigurationFiles=${project.basedir}/reflection-config.
Read more >
graalvm/native-image - Gitter
We finally got it up and running but it seems to miss two files. I have added the option "-H:ReflectionConfigurationResources=resource-config.json" and native ......
Read more >
Fix GraalVM Native Image Build Issues - Simply-How.com
1. Introduction 2. Getting started 3. Build-time errors
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