quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.87k stars 2.71k forks source link

quarkus extensions do not support the yaml configurations and expect in application.properties #22520

Closed debu999 closed 2 years ago

debu999 commented 2 years ago

Describe the bug

quarkus extenstions do not pick up the required configurations from yaml file might be a issue with extensions built without yaml support.

I have added the details to provide a simple use case. Refer to the reproduction guidelines. src/main/java/org/kie/kogito/persistence/KogitoProcessInstancesFactoryImpl.java (4:96) : The type KogitoProcessInstancesFactoryImpl must implement the inherited abstract method KogitoProcessInstancesFactory.dbName() src/main/java/org/kie/kogito/persistence/KogitoProcessInstancesFactoryImpl.java (4:96) : The type KogitoProcessInstancesFactoryImpl must implement the inherited abstract method KogitoProcessInstancesFactory.transactionManager()src/main/java/org/kie/kogito/persistence/KogitoProcessInstancesFactoryImpl.java (4:96) : The type KogitoProcessInstancesFactoryImpl must implement the inherited abstract method KogitoProcessInstancesFactory.dbName()

Full Error Logs:

/Library/Java/JavaVirtualMachines/graalvm-ce-java17-21.3.0/Contents/Home/bin/java -Dmaven.multiModuleProjectDirectory=/Volumes/Doogle SSD/projects/quarkus-yaml-extention-error -Dmaven.home=/Users/debabratapatnaik/.m2/wrapper/dists/apache-maven-3.8.4-bin/52ccbt68d252mdldqsfsn03jlf/apache-maven-3.8.4 -Didea.modules.paths.file=/Users/debabratapatnaik/Library/Caches/JetBrains/IntelliJIdea2021.3/Maven/idea-projects-state-be694b37.properties -Dclassworlds.conf=/private/var/folders/rg/l63fx9xn60gbt247cmz31ps80000gn/T/idea-7-mvn.conf -javaagent:/Volumes/Doogle SSD/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=57145:/Volumes/Doogle SSD/Applications/IntelliJ IDEA.app/Contents/bin -Dfile.encoding=UTF-8 -classpath /Users/debabratapatnaik/.m2/wrapper/dists/apache-maven-3.8.4-bin/52ccbt68d252mdldqsfsn03jlf/apache-maven-3.8.4/boot/plexus-classworlds.license:/Users/debabratapatnaik/.m2/wrapper/dists/apache-maven-3.8.4-bin/52ccbt68d252mdldqsfsn03jlf/apache-maven-3.8.4/boot/plexus-classworlds-2.6.0.jar org.codehaus.classworlds.Launcher -Didea.version=2021.3 quarkus:dev [INFO] Scanning for projects... [INFO] [INFO] --------------< org.doogle:quarkus-yaml-extention-error >--------------- [INFO] Building quarkus-yaml-extention-error 1.0.0-SNAPSHOT [INFO] --------------------------------[ jar ]--------------------------------- [INFO] [INFO] --- quarkus-maven-plugin:2.5.4.Final:dev (default-cli) @ quarkus-yaml-extention-error --- [INFO] Invoking org.apache.maven.plugins:maven-resources-plugin:2.6:resources) @ quarkus-yaml-extention-error [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 2 resources [INFO] Invoking io.quarkus.platform:quarkus-maven-plugin:2.5.4.Final:generate-code) @ quarkus-yaml-extention-error [INFO] Invoking org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile) @ quarkus-yaml-extention-error [INFO] Changes detected - recompiling the module! [INFO] Compiling 1 source file to /Volumes/Doogle SSD/projects/quarkus-yaml-extention-error/target/classes [INFO] Invoking org.apache.maven.plugins:maven-resources-plugin:2.6:testResources) @ quarkus-yaml-extention-error [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] skip non existing resourceDirectory /Volumes/Doogle SSD/projects/quarkus-yaml-extention-error/src/test/resources [INFO] Invoking io.quarkus.platform:quarkus-maven-plugin:2.5.4.Final:generate-code-tests) @ quarkus-yaml-extention-error [INFO] Invoking org.apache.maven.plugins:maven-compiler-plugin:3.8.1:testCompile) @ quarkus-yaml-extention-error [INFO] No sources to compile Listening for transport dt_socket at address: 5005 Press [h] for more options> Tests paused Press [r] to resume testing, [h] for more options> Press [r] to resume testing, [o] Toggle test output, [h] for more options> 2021-12-25 11:39:16,208 INFO [org.kie.kog.cod.api.uti.AddonsConfigDiscovery] (build-22) Performed addonsConfig discovery, found: AddonsConfig{usePersistence=true, useTracing=false, useMonitoring=false, usePrometheusMonitoring=false, useCloudEvents=false, useExplainability=false, useProcessSVG=false, useEventDrivenDecisions=false, useEventDrivenRules=false} 2021-12-25 11:39:16,422 INFO [org.kie.kog.cod.cor.uti.ApplicationGeneratorDiscovery] (build-22) Generator discovery performed, found [openapispecs, processes, rules, decisions, predictions] 2021-12-25 11:39:16,426 INFO [org.kie.kog.cod.cor.ApplicationGenerator] (build-22) Skipping generator 'openapispecs' because disabled 2021-12-25 11:39:16,427 INFO [org.kie.kog.cod.cor.ApplicationGenerator] (build-22) Skipping generator 'processes' because disabled 2021-12-25 11:39:16,429 INFO [org.kie.kog.cod.cor.ApplicationGenerator] (build-22) Skipping generator 'decisions' because disabled 2021-12-25 11:39:16,429 INFO [org.kie.kog.cod.cor.ApplicationGenerator] (build-22) Skipping generator 'predictions' because disabled 2021-12-25 11:39:17,530 INFO [org.kie.kog.cod.api.uti.AddonsConfigDiscovery] (build-45) Performed addonsConfig discovery, found: AddonsConfig{usePersistence=true, useTracing=false, useMonitoring=false, usePrometheusMonitoring=false, useCloudEvents=false, useExplainability=false, useProcessSVG=false, useEventDrivenDecisions=false, useEventDrivenRules=false}

2021-12-25 11:39:17,729 ERROR [org.kie.kog.qua.com.dep.InMemoryCompiler] (build-45) src/main/java/org/kie/kogito/persistence/KogitoProcessInstancesFactoryImpl.java (4:96) : The type KogitoProcessInstancesFactoryImpl must implement the inherited abstract method KogitoProcessInstancesFactory.transactionManager() 2021-12-25 11:39:17,730 ERROR [org.kie.kog.qua.com.dep.InMemoryCompiler] (build-45) src/main/java/org/kie/kogito/persistence/KogitoProcessInstancesFactoryImpl.java (4:96) : The type KogitoProcessInstancesFactoryImpl must implement the inherited abstract method KogitoProcessInstancesFactory.dbName()

2021-12-25 11:39:17,751 INFO [io.qua.dep.dev.IsolatedDevModeMain] (main) Attempting to start live reload endpoint to recover from previous Quarkus startup failure 2021-12-25 11:39:17,922 INFO [org.jbo.threads] (main) JBoss Threads version 3.4.2.Final 2021-12-25 11:39:18,371 ERROR [io.qua.dep.dev.IsolatedDevModeMain] (main) Failed to start quarkus: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step org.kie.kogito.quarkus.processes.deployment.ProcessesAssetsProcessor#postGenerationProcessing threw an exception: java.lang.IllegalStateException: src/main/java/org/kie/kogito/persistence/KogitoProcessInstancesFactoryImpl.java (4:96) : The type KogitoProcessInstancesFactoryImpl must implement the inherited abstract method KogitoProcessInstancesFactory.transactionManager() src/main/java/org/kie/kogito/persistence/KogitoProcessInstancesFactoryImpl.java (4:96) : The type KogitoProcessInstancesFactoryImpl must implement the inherited abstract method KogitoProcessInstancesFactory.dbName() src/main/java/org/kie/kogito/persistence/KogitoProcessInstancesFactoryImpl.java (4:96) : The type KogitoProcessInstancesFactoryImpl must implement the inherited abstract method KogitoProcessInstancesFactory.transactionManager()src/main/java/org/kie/kogito/persistence/KogitoProcessInstancesFactoryImpl.java (4:96) : The type KogitoProcessInstancesFactoryImpl must implement the inherited abstract method KogitoProcessInstancesFactory.dbName() at org.kie.kogito.quarkus.common.deployment.InMemoryCompiler.compile(InMemoryCompiler.java:104) at org.kie.kogito.quarkus.common.deployment.KogitoQuarkusResourceUtils.compileGeneratedSources(KogitoQuarkusResourceUtils.java:168) at org.kie.kogito.quarkus.processes.deployment.ProcessesAssetsProcessor.generatePersistenceInfo(ProcessesAssetsProcessor.java:203) at org.kie.kogito.quarkus.processes.deployment.ProcessesAssetsProcessor.postGenerationProcessing(ProcessesAssetsProcessor.java:165) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:887) at io.quarkus.builder.BuildContext.run(BuildContext.java:277) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478) at java.base/java.lang.Thread.run(Thread.java:833) at org.jboss.threads.JBossThread.run(JBossThread.java:501)

at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:330)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:252)
at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:60)
at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:93)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:456)
at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:67)
at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:149)
at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:105)
at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:145)
at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:63)

Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors [error]: Build step org.kie.kogito.quarkus.processes.deployment.ProcessesAssetsProcessor#postGenerationProcessing threw an exception: java.lang.IllegalStateException: src/main/java/org/kie/kogito/persistence/KogitoProcessInstancesFactoryImpl.java (4:96) : The type KogitoProcessInstancesFactoryImpl must implement the inherited abstract method KogitoProcessInstancesFactory.transactionManager() src/main/java/org/kie/kogito/persistence/KogitoProcessInstancesFactoryImpl.java (4:96) : The type KogitoProcessInstancesFactoryImpl must implement the inherited abstract method KogitoProcessInstancesFactory.dbName() src/main/java/org/kie/kogito/persistence/KogitoProcessInstancesFactoryImpl.java (4:96) : The type KogitoProcessInstancesFactoryImpl must implement the inherited abstract method KogitoProcessInstancesFactory.transactionManager()src/main/java/org/kie/kogito/persistence/KogitoProcessInstancesFactoryImpl.java (4:96) : The type KogitoProcessInstancesFactoryImpl must implement the inherited abstract method KogitoProcessInstancesFactory.dbName() at org.kie.kogito.quarkus.common.deployment.InMemoryCompiler.compile(InMemoryCompiler.java:104) at org.kie.kogito.quarkus.common.deployment.KogitoQuarkusResourceUtils.compileGeneratedSources(KogitoQuarkusResourceUtils.java:168) at org.kie.kogito.quarkus.processes.deployment.ProcessesAssetsProcessor.generatePersistenceInfo(ProcessesAssetsProcessor.java:203) at org.kie.kogito.quarkus.processes.deployment.ProcessesAssetsProcessor.postGenerationProcessing(ProcessesAssetsProcessor.java:165) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:887) at io.quarkus.builder.BuildContext.run(BuildContext.java:277) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478) at java.base/java.lang.Thread.run(Thread.java:833) at org.jboss.threads.JBossThread.run(JBossThread.java:501)

at io.quarkus.builder.Execution.run(Execution.java:116)
at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:161)
at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:328)
... 9 more

Caused by: java.lang.IllegalStateException: src/main/java/org/kie/kogito/persistence/KogitoProcessInstancesFactoryImpl.java (4:96) : The type KogitoProcessInstancesFactoryImpl must implement the inherited abstract method KogitoProcessInstancesFactory.transactionManager() src/main/java/org/kie/kogito/persistence/KogitoProcessInstancesFactoryImpl.java (4:96) : The type KogitoProcessInstancesFactoryImpl must implement the inherited abstract method KogitoProcessInstancesFactory.dbName() src/main/java/org/kie/kogito/persistence/KogitoProcessInstancesFactoryImpl.java (4:96) : The type KogitoProcessInstancesFactoryImpl must implement the inherited abstract method KogitoProcessInstancesFactory.transactionManager()src/main/java/org/kie/kogito/persistence/KogitoProcessInstancesFactoryImpl.java (4:96) : The type KogitoProcessInstancesFactoryImpl must implement the inherited abstract method KogitoProcessInstancesFactory.dbName() at org.kie.kogito.quarkus.common.deployment.InMemoryCompiler.compile(InMemoryCompiler.java:104) at org.kie.kogito.quarkus.common.deployment.KogitoQuarkusResourceUtils.compileGeneratedSources(KogitoQuarkusResourceUtils.java:168) at org.kie.kogito.quarkus.processes.deployment.ProcessesAssetsProcessor.generatePersistenceInfo(ProcessesAssetsProcessor.java:203) at org.kie.kogito.quarkus.processes.deployment.ProcessesAssetsProcessor.postGenerationProcessing(ProcessesAssetsProcessor.java:165) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:568) at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:887) at io.quarkus.builder.BuildContext.run(BuildContext.java:277) at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18) at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449) at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478) at java.base/java.lang.Thread.run(Thread.java:833) at org.jboss.threads.JBossThread.run(JBossThread.java:501)

Expected behavior

SHOULD WORK WITH YAML CONFIGS

WIth Yaml support in main apps all extensions should provide support to yml files and should not be hardwired to properties file only.

Actual behavior

NOT WORKING IF APPLICATION.PROPERTIES IS MISSING

If missing application.properties file application should scan application.yml internally makes the extensions register properly.

How to Reproduce?

Reproducer:

Steps to reproduce the error:

  1. git clone https://github.com/debu999/quarkus-yaml-extention-error.git or gh repo clone debu999/quarkus-yaml-extention-error
  2. git checkout working/withproperties
  3. mvn clean compile quarkus:dev
  4. delete the target folder if needed
  5. git checkout bug/withoutproperties
  6. mvn clean compile quarkus:dev
  7. you will see the error must implement the inherited abstract method KogitoProcessInstancesFactory.dbName()...

Screenshot 2021-12-25 at 11 54 23 AM

Output of uname -a or ver

Darwin DEBABRATAs-Mini.bbrouter 20.6.0 Darwin Kernel Version 20.6.0: Wed Jun 23 00:26:27 PDT 2021; root:xnu-7195.141.2~5/RELEASE_ARM64_T8101 arm64

Output of java -version

openjdk version "17.0.1" 2021-10-19 OpenJDK Runtime Environment GraalVM CE 21.3.0 (build 17.0.1+12-jvmci-21.3-b05) OpenJDK 64-Bit Server VM GraalVM CE 21.3.0 (build 17.0.1+12-jvmci-21.3-b05, mixed mode, sharing)

GraalVM version (if different from Java)

No response

Quarkus version or git rev

2.5.4.Final

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

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537) Maven home: /Users/debabratapatnaik/.m2/wrapper/dists/apache-maven-3.8.4-bin/52ccbt68d252mdldqsfsn03jlf/apache-maven-3.8.4 Java version: 17.0.1, vendor: GraalVM Community, runtime: /Library/Java/JavaVirtualMachines/graalvm-ce-java17-21.3.0/Contents/Home Default locale: en_IN, platform encoding: US-ASCII OS name: "mac os x", version: "11.5.2", arch: "x86_64", family: "mac"

Additional information

this is mostly because of the fact the extensions are built without yaml support and cant get data from application.yml or applicatoin-{PROFILE}.yml and looks only at application.properties file.

Its worth to look at if quarkus profiles cascade to extensions correctly or they need everything in application.properties file. May be a one off for kogito-persistence-mongo but worth a shot to have this made consistent to all addons or extensions Screenshot 2021-12-25 at 11 54 23 AM .

debu999 commented 2 years ago

Any update on this bug. Is there anything to do for yaml config to cascade to extensions automatically

gsmet commented 2 years ago

@debu999 it would be helpful if you could add the content of the application.properties in your repo. Just comment out the properties. That way, we can easily check the differences.

@evacchi any chance you could have a look at this one? I mean even if the properties were ignored, I wouldn't expect a compilation error? I checked the pom and it's using the platform so it looks OK version wise.

debu999 commented 2 years ago

@gsmet There are 2 branches. 1 working - working/withproperties 1 not working - bug/withoutproperties Do checkout and run please. Screenshot 2022-01-01 at 5 28 22 PM

gsmet commented 2 years ago

Ah, cool, perfect!

evacchi commented 2 years ago

@cristianonicolai @tiagodolphine (BTW happy new year everyone 🎉 🥳 )

debu999 commented 2 years ago

Yeah just got in to new year. M becoming a fan of Quarkus, just felt I have wasted a lot of time with spring boot. This year focusing on smart and efficient coding.

cristianonicolai commented 2 years ago

@debu999 this should be fixed already in Kogito 1.15 by this JIRA https://issues.redhat.com/browse/KOGITO-6265. The release is in progress at this stage, should be out soon.

cristianonicolai commented 2 years ago

@debu999 have you been able to verify that this is fixed on version 1.15?

debu999 commented 2 years ago

Yes. Works like a charm now no issue with application.yml usage quarkus 2.6.2.Final works fine with kogito 1.15.0.Final <dependency>   <groupId>${quarkus.platform.group-id}</groupId>   <artifactId>quarkus-kogito-bom</artifactId>   <version>${quarkus.platform.version}</version>   <type>pom<type>   <scope>import</scope> </dependency>

Also tested with kogito 1.16.0.Final recently launched. No issues. <dependency>   <groupId>org.kie.kogito</groupId>   <artifactId>kogito-quarkus-bom</artifactId>   <version>1.16.0.Final</version>   <type>pom<type>   <scope>import</scope> </dependency>

Thanks for solving the issue so quick.