user4695271
user4695271

Reputation:

Configuring application using application.yaml instead of application.properties

I have a small Quarkus 1.1.0.Final Web application (using Java 1.8). I'm trying to use a YAML file to configure the application (instead of the usual application.properties) but there is no way the application comes up. I'm always getting this not-so-useful error message(s):

13:53:32,494 ERROR [io.qua.dev.DevModeMain] Failed to start Quarkus: java.lang.RuntimeException: io.quarkus.builder.ChainBuildException: No producers for required item class io.quarkus.deployment.builditem.BuildTimeRunTimeFixedConfigurationBuildItem
    at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:180)
    at io.quarkus.dev.DevModeMain.doStart(DevModeMain.java:177)
    at io.quarkus.dev.DevModeMain.start(DevModeMain.java:95)
    at io.quarkus.dev.DevModeMain.main(DevModeMain.java:66)
Caused by: io.quarkus.builder.ChainBuildException: No producers for required item class io.quarkus.deployment.builditem.BuildTimeRunTimeFixedConfigurationBuildItem
    at io.quarkus.builder.BuildChainBuilder.build(BuildChainBuilder.java:240)
    at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:112)
    at io.quarkus.runner.RuntimeRunner.run(RuntimeRunner.java:113)
    ... 3 more

13:53:32,519 INFO  [io.qua.dev.DevModeMain] Attempting to start hot replacement endpoint to recover from previous Quarkus startup failure
13:53:32,532 ERROR [io.qua.dev.DevModeMain] Failed to start quarkus: java.lang.IllegalArgumentException: workerPoolSize must be > 0
    at io.vertx.core.VertxOptions.setWorkerPoolSize(VertxOptions.java:275)
    at io.quarkus.vertx.core.runtime.VertxCoreRecorder.convertToVertxOptions(VertxCoreRecorder.java:151)
    at io.quarkus.vertx.core.runtime.VertxCoreRecorder.initializeWeb(VertxCoreRecorder.java:104)
    at io.quarkus.vertx.http.runtime.VertxHttpRecorder.startServerAfterFailedStart(VertxHttpRecorder.java:115)
    at io.quarkus.vertx.http.deployment.devmode.VertxHotReplacementSetup.handleFailedInitialStart(VertxHotReplacementSetup.java:30)
    at io.quarkus.dev.RuntimeUpdatesProcessor.startupFailed(RuntimeUpdatesProcessor.java:449)
    at io.quarkus.dev.DevModeMain.doStart(DevModeMain.java:191)
    at io.quarkus.dev.DevModeMain.start(DevModeMain.java:95)
    at io.quarkus.dev.DevModeMain.main(DevModeMain.java:66)

This is my YAML file:

#
# https://quarkus.io/guides/all-config
# https://quarkus.io/guides/config#overriding-properties-at-runtime
quarkus:
  datasource:
    driver: org.postgresql.Driver
  flyway:
    migrate-at-start: true
  health:
    extensions:
      enabled: true
  hibernate-orm:
    dialect: org.hibernate.dialect.PostgreSQL10Dialect
  http:
    port: 8080
  log: # ALL > FINEST > FINER > FINE > CONFIG > INFO > WARNING > SEVERE > OFF
    console:
      async: true
      color: true
      enable: true
      format: "%d{yyyy-MM-dd HH:mm:ss,SSS} |- %-5p in %c:%L{3.} [%t] - %s%e%n"
    level: WARNING
  resteasy:
    path: /api
  smallrye-openapi:
    path: /open-api
  swagger-ui:
    always-include: true
    path: /swagger-ui

"%dev":
  quarkus:
    datasource:
      password: postgres
      url: jdbc:postgresql://localhost:5432/quarkus_web
      username: postgres
    flyway:
      clean-at-start: true
    hibernate-orm:
      log:
        sql: true
      statistics: true
    log:
      category:
        "io.quarkus.arc.processor":
          level: OFF
        "io.quarkus":
          level: INFO
        "org.acme":
          level: CONFIG

"%prod":
  quarkus:
    datasource:
      password: postgres
      url: jdbc:postgresql://localhost:5432/quarkus_web
      username: postgres
    flyway:
      clean-at-start: false
    hibernate-orm:
      database:
        generation: none
      sql-load-script: no-file

"%test":
  quarkus:
    datasource:
      password: postgres
      url: jdbc:postgresql://localhost:5432/quarkus_web
      username: postgres
    flyway:
      clean-at-start: true
    log:
      category:
        "io.quarkus":
          level: WARNING
        "org.acme":
          level: WARNING

Anyone using this approach already and succeeded? I'm including io.quarkus:quarkus-config-yaml:1.1.0.Final.

One thing that I've noticed is that I can't separate the profiles using --- as I do with Spring Boot. I think I should file an issue for this :thinking_face:

Upvotes: -1

Views: 3321

Answers (2)

user4695271
user4695271

Reputation:

Turns out this was not an issue. I just had an old Gradle config; some things changed with the Gradle plugin with version 1.1.0.Final and I just didn't have those.

Upvotes: 1

Guillaume Smet
Guillaume Smet

Reputation: 10529

It certainly looks like a bug, maybe even 2 as the second error message doesn't look like something I would expect considering your configuration file.

Could you create a bug in our tracker: https://github.com/quarkusio/quarkus/issues/new?assignees=&labels=bug&template=bug_report.md&title= ?

It would be nice if you could provide a reproducer. AFAICS, Quarkus doesn't start at all so probably your pom.xml with the various extensions you use and your configuration file should be enough to reproduce the issue.

Upvotes: 0

Related Questions