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

NPE in ConfigMapping on Native when using -H:ResourceConfigurationFiles or quarkus.native.resources.includes property #17653

Closed
Sgitario opened this issue Jun 3, 2021 · 3 comments · Fixed by #17736
Labels
area/config kind/bug Something isn't working
Milestone

Comments

@Sgitario
Copy link
Contributor

Sgitario commented Jun 3, 2021

Describe the bug

Using an application that needs a resource, when registering this external resource for Native via:

  • Or pom.xml:
<profiles>
        <profile>
            <id>native</id>
            <properties>
                <quarkus.native.additional-build-args>-H:ResourceConfigurationFiles=resources-config.json</quarkus.native.additional-build-args>
            </properties>
        </profile>
    </profiles>

And:

{
  "resources": [
    {
      "pattern": "configsource.properties"
    }
  ]
}
  • Or via Quarkus property:
quarkus.native.resources.includes=configsource.properties

It builds ok, but when running the Native tests or running the Native app with the next Null pointer exception:

2021-06-03 08:01:05,613 ERROR [io.qua.run.Application] (main) Failed to start application (with profile prod): java.lang.NullPointerException
        at io.smallrye.config.ConfigMappingContext.getConverter(ConfigMappingContext.java:97)
        at io.smallrye.config.ConfigMappingContext.lambda$getValueConverter$4(ConfigMappingContext.java:92)
        at java.util.HashMap.computeIfAbsent(HashMap.java:1133)
        at io.smallrye.config.ConfigMappingContext.getValueConverter(ConfigMappingContext.java:89)
        at io.quarkus.qe.config.interfaces.ProtagonistConfigurable1275545271Impl.<init>(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:490)
        at io.smallrye.config.ConfigMappingLoader.configMappingObject(ConfigMappingLoader.java:55)
        at io.smallrye.config.ConfigMappingContext.constructGroup(ConfigMappingContext.java:80)
        at io.smallrye.config.ConfigMappingContext.constructRoot(ConfigMappingContext.java:76)
        at io.smallrye.config.ConfigMappingProvider.mapConfiguration(ConfigMappingProvider.java:794)
        at io.smallrye.config.ConfigMappingProvider.mapConfiguration(ConfigMappingProvider.java:777)
        at io.smallrye.config.ConfigMappings.mapConfiguration(ConfigMappings.java:54)
        at io.smallrye.config.ConfigMappings.registerConfigMappings(ConfigMappings.java:36)
        at io.quarkus.arc.runtime.ConfigRecorder.registerConfigMappings(ConfigRecorder.java:50)
        at io.quarkus.deployment.steps.ConfigBuildStep$registerConfigClasses-2116437784.deploy_0(ConfigBuildStep$registerConfigClasses-2116437784.zig:292)
        at io.quarkus.deployment.steps.ConfigBuildStep$registerConfigClasses-2116437784.deploy(ConfigBuildStep$registerConfigClasses-2116437784.zig:40)
        at io.quarkus.runner.ApplicationImpl.doStart(ApplicationImpl.zig:513)
        at io.quarkus.runtime.Application.start(Application.java:101)
        at io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:101)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:66)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:42)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:119)
        at io.quarkus.runner.GeneratedMain.main(GeneratedMain.zig:29)

To Reproduce

Steps to reproduce the behavior:

  1. git clone https://github.com/Sgitario/beefy-scenarios
  2. cd beefy-scenarios
  3. git checkout reproducer_17653
  4. cd 022-quarkus-properties-config-all
  5. mvn clean verify -Dnative

It fails when running the tests with the above exception.

Environment (please complete the following information):

GraalVM version (if different from Java)

GraalVM 21.0.0.2
GraalVM 21.1.0

Quarkus version or git rev

999-SNAPSHOT

@Sgitario Sgitario added the kind/bug Something isn't working label Jun 3, 2021
@Sgitario
Copy link
Contributor Author

Sgitario commented Jun 3, 2021

cc @radcortez maybe this is related to the new @ConfigMapping annotation changes?

Sgitario added a commit to Sgitario/beefy-scenarios that referenced this issue Jun 3, 2021
Adding external properties on Native make the app fail to start. Reported by quarkusio/quarkus#17653
Sgitario added a commit to Sgitario/beefy-scenarios that referenced this issue Jun 3, 2021
Adding external properties on Native make the app fail to start. Reported by quarkusio/quarkus#17653
sd
Sgitario added a commit to Sgitario/beefy-scenarios that referenced this issue Jun 3, 2021
Adding external properties on Native make the app fail to start. Reported by quarkusio/quarkus#17653
sd
@radcortez
Copy link
Member

Not sure. I'll need to check. Did it work without adding the argument?

@radcortez
Copy link
Member

Ok, the issue is related with the IBiography hierarchy. We are not automatically registering for reflection the config mapping hierarchy (if any). I'll make a fix for this.

For now, you can workaround this by adding a @RegisterForReflection in any hierarchy classes.

@quarkus-bot quarkus-bot bot added this to the 2.1 - main milestone Jun 8, 2021
Sgitario added a commit to Sgitario/beefy-scenarios that referenced this issue Jun 8, 2021
The issue quarkusio/quarkus#17653 has been fixed, so we can enable the tests back.
I confirmed that these tests are now working fine.
@gsmet gsmet modified the milestones: 2.1 - main, 2.0.0.Final Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/config kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants