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

java.util.NoSuchElementException: Property quarkus.application.name not found #9177

Closed
vladimirfx opened this issue May 8, 2020 · 9 comments · Fixed by #9471
Closed

java.util.NoSuchElementException: Property quarkus.application.name not found #9177

vladimirfx opened this issue May 8, 2020 · 9 comments · Fixed by #9471
Assignees
Labels
area/gradle Gradle kind/bug Something isn't working
Milestone

Comments

@vladimirfx
Copy link

Describe the bug

Config quarkus.application.name not accessible in application.properties

Expected behavior

${quarkus.application.name} should be interpolated.

Actual behavior

java.util.NoSuchElementException: Property quarkus.application.name not found

To Reproduce
Steps to reproduce the behavior:

  1. Generate Camel Quarkus (Gradle) project on Quarkus Starter
  2. Set in application.properties :

`# Configuration file

camel.context.name = ${quarkus.application.name}
`

  1. Run:

./gradlew quarkusDev

Configuration

# Configuration file
camel.context.name = ${quarkus.application.name}

Environment (please complete the following information):

  • Output of uname -a or ver: 19.4.0 Darwin Kernel Version 19.4.0
  • Output of java -version: openjdk version "11.0.6" 2020-01-14 LTS
  • GraalVM version (if different from Java):
  • Quarkus version or git rev: 1.4.2
  • Build tool (ie. output of mvnw --version or gradlew --version): Gradle 6.3
@vladimirfx vladimirfx added the kind/bug Something isn't working label May 8, 2020
@geoand
Copy link
Contributor

geoand commented May 8, 2020

This only affects tests (a known limitation), dev-mode and the jar work properly.

I propose that you do the following in order to make the property available in tests:

%test.camel.context.name=test-value

You could also set the value manually to what the artifactId of the project is (this is what Quarkus defaults to).

@geoand geoand closed this as completed May 8, 2020
@geoand geoand added the triage/invalid This doesn't seem right label May 8, 2020
@vladimirfx
Copy link
Author

vladimirfx commented May 8, 2020

Not, exactly dev mode not work

./gradlew quarkusDev

It is stated in reproduction flow.

@vladimirfx
Copy link
Author

I can provide simple test project.

@geoand
Copy link
Contributor

geoand commented May 8, 2020

Then that is new. Yes please create a sample project and attach it to the issue.

@geoand geoand removed the triage/invalid This doesn't seem right label May 8, 2020
@geoand geoand reopened this May 8, 2020
@geoand
Copy link
Contributor

geoand commented May 8, 2020

cc @aloubyansky who has done a lot of Gradle work lately

@geoand geoand added the area/gradle Gradle label May 8, 2020
@vladimirfx
Copy link
Author

Sample project. Generated from Starter, removed irrelevant REST resource and added Camel route.

9177.zip

@aloubyansky
Copy link
Member

aloubyansky commented May 18, 2020

Thanks a lot for the reproducer. Bad news, looks like with master it's getting even worse

> Task :quarkusBuild FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':quarkusBuild'.
> io.quarkus.builder.BuildException: Build failure: Build failed due to errors
        [error]: Build step io.quarkus.arc.deployment.ArcProcessor#validate threw an exception: javax.enterprise.inject.spi.DeploymentException: Found 4 deployment problems: 
  [1] Unsatisfied dependency for type io.quarkus.scheduler.runtime.SchedulerRuntimeConfig and qualifiers [@Default]
        - java member: io.quarkus.quartz.runtime.QuartzScheduler#<init>()
        - declared on CLASS bean [types=[java.lang.Object, io.quarkus.quartz.runtime.QuartzScheduler, io.quarkus.scheduler.Scheduler], qualifiers=[@Default, @Any], target=io.quarkus.quartz.runtime.QuartzScheduler]
  [2] Unsatisfied dependency for type io.quarkus.quartz.runtime.QuartzRuntimeConfig and qualifiers [@Default]
        - java member: io.quarkus.quartz.runtime.QuartzSupport#<init>()
        - declared on CLASS bean [types=[java.lang.Object, io.quarkus.quartz.runtime.QuartzSupport], qualifiers=[@Default, @Any], target=io.quarkus.quartz.runtime.QuartzSupport]
  [3] Unsatisfied dependency for type io.quarkus.quartz.runtime.QuartzBuildTimeConfig and qualifiers [@Default]
        - java member: io.quarkus.quartz.runtime.QuartzSupport#<init>()
        - declared on CLASS bean [types=[java.lang.Object, io.quarkus.quartz.runtime.QuartzSupport], qualifiers=[@Default, @Any], target=io.quarkus.quartz.runtime.QuartzSupport]
  [4] Unsatisfied dependency for type java.util.Optional<java.lang.String> and qualifiers [@Default]
        - java member: io.quarkus.quartz.runtime.QuartzSupport#<init>()
        - declared on CLASS bean [types=[java.lang.Object, io.quarkus.quartz.runtime.QuartzSupport], qualifiers=[@Default, @Any], target=io.quarkus.quartz.runtime.QuartzSupport]
        at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:981)

quarkusDev and quarkusBuild fail in the same way though.

@aloubyansky
Copy link
Member

This is an example of a major issue in our gradle app model resolver. This wouldn't happen in an equivalent Maven project. Although, I think it's a good opportunity to review both and come up with a single principle to version alignment.
The issue is the deployment dependencies aren't properly aligned.

@aloubyansky
Copy link
Member

Oh, once the version alignment is properly done, I'm seeing the original issue about the property not being found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/gradle Gradle kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants