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

Cannot load fixed or default YAML configuration when running native build #36326

Closed
ungaralex opened this issue Oct 6, 2023 · 4 comments · Fixed by #36404
Closed

Cannot load fixed or default YAML configuration when running native build #36326

ungaralex opened this issue Oct 6, 2023 · 4 comments · Fixed by #36404
Labels
Milestone

Comments

@ungaralex
Copy link

Describe the bug

When building a native image using YAML configurations (application.yml with application-prod.yml for the prod build in this case), Quarkus is not able to load any specific configuration properties that are not configured by setting an environment variable. This includes cases with plain hardcoded values as well as environment variables with fallbacks:

my:
  config:
    someConf: 42
    envConfigWithFallback: ${MY_CONFIG:defaultValue}

Only if you configure a property with a pure environment variable it works:

my:
  config:
    someConf: ${MY_CONFIG}

Interestingly enough, all of the above cases work fine when setting Quarkus specific properties under quarkus: ..... Only for custom application specific props, the values are not loaded.

The exception given is

Failed to load config value of type class java.lang.String for: my.config.stringConfig
Failed to load config value of type int for: my.config.intConfig

Expected behavior

Quarkus application configuration with the io.quarkus:quarkus-config-yaml extension should be able to load all configuration properties of the following cases:

my:
  config:
    someConf: 42
    envConfigWithFallback: ${MY_CONFIG:defaultValue}
    envConfig: ${MY_CONFIG}

Actual behavior

Starting the native executable fails with the exception (given for the mentioned examples) with error

Failed to load config value of type class java.lang.String for: my.config.stringConfig
Failed to load config value of type int for: my.config.intConfig

How to Reproduce?

Using the attached project:

  1. Build the native executable withquarkus build --native --no-tests -Dquarkus.native.container-build=true
  2. Then build the Docker image with docker build -f src/main/docker/Dockerfile.native-micro -t quarkus-yaml-bug .
  3. Run docker run -i --rm quarkus-yaml-bug to observe the error

native-quarkus-yaml-bug.zip

Output of uname -a or ver

Darwin X6X29CW95F 23.0.0 Darwin Kernel Version 23.0.0: Fri Sep 15 14:41:43 PDT 2023; root:xnu-10002.1.13~1/RELEASE_ARM64_T6000 arm64

Output of java -version

openjdk 17.0.8.1 2023-08-24 OpenJDK Runtime Environment Temurin-17.0.8.1+1 (build 17.0.8.1+1) OpenJDK 64-Bit Server VM Temurin-17.0.8.1+1 (build 17.0.8.1+1, mixed mode)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.4.1

Build tool (ie. output of mvnw --version or gradlew --version)

8.3

Additional information

No response

@ungaralex ungaralex added the kind/bug Something isn't working label Oct 6, 2023
@gsmet
Copy link
Member

gsmet commented Oct 6, 2023

/cc @radcortez see the reproducer above ^

@radcortez
Copy link
Member

Will do.

@OrdinarySF
Copy link

OrdinarySF commented Oct 10, 2023

Same problem.

Now only can input command args.

Update: version 3.3.3 can wrok.

@bfrevel
Copy link

bfrevel commented Oct 10, 2023

Same problem here. Possible workaround is -Dquarkus.native.resources.includes=application.properties

@quarkus-bot quarkus-bot bot added this to the 3.6 - main milestone Oct 11, 2023
@gsmet gsmet modified the milestones: 3.6 - main, 3.4.3 Oct 11, 2023
benkard pushed a commit to benkard/mulkcms2 that referenced this issue Nov 12, 2023
This MR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [flow-bin](https://github.com/flowtype/flow-bin) ([changelog](https://github.com/facebook/flow/blob/master/Changelog.md)) | devDependencies | minor | [`^0.217.0` -> `^0.219.0`](https://renovatebot.com/diffs/npm/flow-bin/0.217.2/0.219.0) |
| [io.hypersistence:hypersistence-utils-hibernate-62](https://github.com/vladmihalcea/hypersistence-utils) | compile | minor | `3.5.3` -> `3.6.0` |
| [io.quarkus:quarkus-maven-plugin](https://github.com/quarkusio/quarkus) | build | patch | `3.4.2` -> `3.4.3` |
| [io.quarkus:quarkus-universe-bom](https://github.com/quarkusio/quarkus-platform) | import | patch | `3.4.2` -> `3.4.3` |

---

### Release Notes

<details>
<summary>flowtype/flow-bin</summary>

### [`v0.219.0`](flow/flow-bin@1268ec5...c184c5d)

[Compare Source](flow/flow-bin@1268ec5...c184c5d)

### [`v0.218.1`](flow/flow-bin@12afce4...1268ec5)

[Compare Source](flow/flow-bin@12afce4...1268ec5)

### [`v0.218.0`](flow/flow-bin@dc93913...12afce4)

[Compare Source](flow/flow-bin@dc93913...12afce4)

</details>

<details>
<summary>vladmihalcea/hypersistence-utils</summary>

### [`v3.6.0`](https://github.com/vladmihalcea/hypersistence-utils/blob/HEAD/changelog.txt#Version-360---October-12-2023)

\================================================================================

Implement QueryStackTraceLogger using StackWalker [#&#8203;659](vladmihalcea/hypersistence-utils#659)

Add JFR based query logger [#&#8203;658](vladmihalcea/hypersistence-utils#658)

Adds support for using MonetaryAmount in [@&#8203;ElementCollection](https://github.com/ElementCollection) [#&#8203;652](vladmihalcea/hypersistence-utils#652)

</details>

<details>
<summary>quarkusio/quarkus</summary>

### [`v3.4.3`](https://github.com/quarkusio/quarkus/releases/tag/3.4.3)

[Compare Source](quarkusio/quarkus@3.4.2...3.4.3)

##### Complete changelog

-   [#&#8203;36408](quarkusio/quarkus#36408) - Ensure that SSE builder works in native
-   [#&#8203;36404](quarkusio/quarkus#36404) - Do not exclude properties from recording that are available in sources that should always be included
-   [#&#8203;36403](quarkusio/quarkus#36403) - IBM Db2 - Register resource bundle classes for reflection
-   [#&#8203;36402](quarkusio/quarkus#36402) - Native Picocli build breaks SSE client
-   [#&#8203;36399](quarkusio/quarkus#36399) - quarkus-jdbc-db2: resource bundle missing
-   [#&#8203;36377](quarkusio/quarkus#36377) - Allow `@ClientHeaderParam` to override User-Agent
-   [#&#8203;36371](quarkusio/quarkus#36371) - Fix issue in Java migration in dev-mode
-   [#&#8203;36351](quarkusio/quarkus#36351) - Properly handle invalid response body errors in Reactive REST Client
-   [#&#8203;36329](quarkusio/quarkus#36329) - Custom User-Agent header ignored
-   [#&#8203;36326](quarkusio/quarkus#36326) - Cannot load fixed or default YAML configuration when running native build
-   [#&#8203;36302](quarkusio/quarkus#36302) - Fix headers and preambles in all guides and reintroduce some keywords
-   [#&#8203;36299](quarkusio/quarkus#36299) - quarkus-flyway: Java-Migration does not get picked up on live reload
-   [#&#8203;36290](quarkusio/quarkus#36290) - Fixed URL for configuring JSON support
-   [#&#8203;36257](quarkusio/quarkus#36257) - Rest client call hangs when receiving an invalid chunked response and does not release resources (e.g. Bulkhead semaphore)
-   [#&#8203;36147](quarkusio/quarkus#36147) - Bump org.eclipse.parsson:parsson from 1.1.2 to 1.1.4
-   [#&#8203;36096](quarkusio/quarkus#36096) - Build cache - Use notCacheableBecause instead of storeEnabled
-   [#&#8203;35929](quarkusio/quarkus#35929) - Do not store build cache for core extensions having config
-   [#&#8203;35927](quarkusio/quarkus#35927) - Build cache - Core extensions containing config shouldn't be cached
-   [#&#8203;35769](quarkusio/quarkus#35769) - Default response content type using GraphQL spec

</details>

<details>
<summary>quarkusio/quarkus-platform</summary>

### [`v3.4.3`](quarkusio/quarkus-platform@3.4.2...3.4.3)

[Compare Source](quarkusio/quarkus-platform@3.4.2...3.4.3)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever MR is behind base branch, or you tick the rebase/retry checkbox.

👻 **Immortal**: This MR will be recreated if closed unmerged. Get [config help](https://github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4yNC4wIiwidXBkYXRlZEluVmVyIjoiMzQuMjQuMCJ9-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants