Quarkus: CDI Seems to break when kapt plugin is enabled

Created on 5 Aug 2020  路  7Comments  路  Source: quarkusio/quarkus

Describe the bug
CDI seems to fail only when running quarkusDev from clean, when kapt plugin is enabled in my domain module. However, it runs fine a second time when not running from clean.

kapt plugin is being used for org.mapstruct:mapstruct-processor:1.4.0.Beta1

2020-08-05 14:49:48,636 ERROR [io.qua.dep.dev.DevModeMain] (main) Failed to start Quarkus: java.lang.RuntimeException: 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: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.example.quarkusmm.port.CustomerService and qualifiers [@Default]
        - java member: com.example.quarkusmm.ExampleResource#service
        - declared on CLASS bean [types=[com.example.quarkusmm.ExampleResource, java.lang.Object], qualifiers=[@Default, @Any], target=com.example.quarkusmm.ExampleResource]
        at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:978)
        at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:242)
        at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:146)
        at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:359)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:932)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
        at java.base/java.lang.Thread.run(Thread.java:832)
        at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.example.quarkusmm.port.CustomerService and qualifiers [@Default]
        - java member: com.example.quarkusmm.ExampleResource#service
        - declared on CLASS bean [types=[com.example.quarkusmm.ExampleResource, java.lang.Object], qualifiers=[@Default, @Any], target=com.example.quarkusmm.ExampleResource]
        at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:486)
        at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:362)
        at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:234)
        ... 14 more

        at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:247)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:130)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:52)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.firstStart(IsolatedDevModeMain.java:65)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:301)
        at io.quarkus.deployment.dev.IsolatedDevModeMain.accept(IsolatedDevModeMain.java:42)
        at io.quarkus.bootstrap.app.CuratedApplication.runInCl(CuratedApplication.java:131)
        at io.quarkus.bootstrap.app.CuratedApplication.runInAugmentClassLoader(CuratedApplication.java:84)
        at io.quarkus.deployment.dev.DevModeMain.start(DevModeMain.java:126)
        at io.quarkus.deployment.dev.DevModeMain.main(DevModeMain.java:56)
Caused by: 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: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.example.quarkusmm.port.CustomerService and qualifiers [@Default]
        - java member: com.example.quarkusmm.ExampleResource#service
        - declared on CLASS bean [types=[com.example.quarkusmm.ExampleResource, java.lang.Object], qualifiers=[@Default, @Any], target=com.example.quarkusmm.ExampleResource]
        at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:978)
        at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:242)
        at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:146)
        at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:359)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:932)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
        at java.base/java.lang.Thread.run(Thread.java:832)
        at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.example.quarkusmm.port.CustomerService and qualifiers [@Default]
        - java member: com.example.quarkusmm.ExampleResource#service
        - declared on CLASS bean [types=[com.example.quarkusmm.ExampleResource, java.lang.Object], qualifiers=[@Default, @Any], target=com.example.quarkusmm.ExampleResource]
        at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:486)
        at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:362)
        at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:234)
        ... 14 more

        at io.quarkus.builder.Execution.run(Execution.java:115)
        at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
        at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:149)
        at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:245)
        ... 9 more
Caused by: javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.example.quarkusmm.port.CustomerService and qualifiers [@Default]
        - java member: com.example.quarkusmm.ExampleResource#service
        - declared on CLASS bean [types=[com.example.quarkusmm.ExampleResource, java.lang.Object], qualifiers=[@Default, @Any], target=com.example.quarkusmm.ExampleResource]
        at io.quarkus.arc.processor.BeanDeployment.processErrors(BeanDeployment.java:978)
        at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:242)
        at io.quarkus.arc.processor.BeanProcessor.initialize(BeanProcessor.java:146)
        at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:359)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:932)
        at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
        at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
        at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
        at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
        at java.base/java.lang.Thread.run(Thread.java:832)
        at org.jboss.threads.JBossThread.run(JBossThread.java:479)
Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.example.quarkusmm.port.CustomerService and qualifiers [@Default]
        - java member: com.example.quarkusmm.ExampleResource#service
        - declared on CLASS bean [types=[com.example.quarkusmm.ExampleResource, java.lang.Object], qualifiers=[@Default, @Any], target=com.example.quarkusmm.ExampleResource]
        at io.quarkus.arc.processor.Beans.resolveInjectionPoint(Beans.java:486)
        at io.quarkus.arc.processor.BeanInfo.init(BeanInfo.java:362)
        at io.quarkus.arc.processor.BeanDeployment.init(BeanDeployment.java:234)
        ... 14 more

To Reproduce
Steps to reproduce the behavior:

  1. Clone https://github.com/danelowe/quarkusmm/tree/284614cc0b6a5e4b27a36085ffca7f651c83fd2c
  2. run ./gradlew clean quarkusDev, fails with javax.enterprise.inject.spi.DeploymentException: javax.enterprise.inject.UnsatisfiedResolutionException: Unsatisfied dependency for type com.example.quarkusmm.port.CustomerService and qualifiers [@Default]
  3. run ./gradlew quarkusDev, runs fine.

Environment (please complete the following information):

  • Darwin Danes-MBP 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64
  • Output of java -version:
    openjdk version "14.0.1" 2020-04-14
    OpenJDK Runtime Environment (build 14.0.1+7)
    OpenJDK 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)
  • Quarkus version or git rev: 1.5.2.Final

- Build tool

Gradle 6.3

Build time: 2020-03-24 19:52:07 UTC
Revision: bacd40b727b0130eeac8855ae3f9fd9a0b207c60

Kotlin: 1.3.70
Groovy: 2.5.10
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 14.0.1 (Oracle Corporation 14.0.1+7)
OS: Mac OS X 10.15.5 x86_64

arearc aregradle arekotlin kinbug

All 7 comments

/cc @mkouba, @manovotn

@danelowe I just ran a test with the latest version of quarkus (999-SNAPSHOT) and it worked. I will add a new test in our integration-test module to make sure we don't introduce any regression in the future.
Can you test with a 1.7.1.Final version of quarkus?

@glefloch I just upgraded the example to 1.7.1.Final and still have the same issues with running quarkusDev from clean.

https://github.com/danelowe/quarkusmm/tree/16aaf4547a176562a5d7e14177ffe3bbec8bbbc7

To clarify, in order to run this from clean I have to run quarkusDev, see the error, then change a source file and re-run quarkusDev.

This is an improvement however. I was unable to get 1.7.0.Final working earlier (due to something related to https://youtrack.jetbrains.com/issue/KT-29513). I can now upgrade Kotlin.

@danelowe I checked out your commit and quarkusDev does not throw any error. I can see howdydoody when querying localhost:8080/hello. If I update the ExampleResource, the quarkusDev tasks detects the changes and the result is updated.

@glefloch So you checked out the commit and immediately ran ./gradlew clean quarkusDev? That is interesting. Suggests the issue has something to do with my environment?

I tried deleting the project and cloning it again, and still had the issue. I've tried OpenJDK, AdoptOpenJDK, GraalVM. I've tried deleting ~/.gradle.

@danelowe I can reproduce it with the clean. The issue is only happening on multi-module project. I keep investigating

I spent some times trying to fix this issue. The problem looks related to the kaptKotlin task which seems to do something wrong. skipping it makes the error go away..

Was this page helpful?
0 / 5 - 0 ratings