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

CDI Seems to break when kapt plugin is enabled #11215

Closed
danelowe opened this issue Aug 5, 2020 · 8 comments
Closed

CDI Seems to break when kapt plugin is enabled #11215

danelowe opened this issue Aug 5, 2020 · 8 comments
Labels
area/arc Issue related to ARC (dependency injection) area/gradle Gradle area/kotlin kind/bug Something isn't working

Comments

@danelowe
Copy link

danelowe commented Aug 5, 2020

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

@danelowe danelowe added the kind/bug Something isn't working label Aug 5, 2020
@quarkusbot
Copy link

/cc @mkouba, @manovotn

@quarkusbot quarkusbot added the area/arc Issue related to ARC (dependency injection) label Aug 5, 2020
@glefloch
Copy link
Member

@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?

@danelowe
Copy link
Author

@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.

@glefloch
Copy link
Member

glefloch commented Sep 1, 2020

@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.

@danelowe
Copy link
Author

danelowe commented Sep 1, 2020

@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.

@glefloch
Copy link
Member

glefloch commented Sep 2, 2020

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

@glefloch
Copy link
Member

glefloch commented Sep 4, 2020

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..

lhenriquegomescamilo added a commit to lhenriquegomescamilo/my-ifood that referenced this issue Oct 12, 2020
… the quarkus not provides an extension or processor notation to kotlin and mapstruct:

* quarkusio/quarkus#5956
* quarkusio/quarkus#11215
@mkouba
Copy link
Contributor

mkouba commented Jul 20, 2021

I'm going to close this one as it looks like the problem is not related to ArC. Feel free to reopen it if you believe that there's something we could fix.

@mkouba mkouba closed this as completed Jul 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/arc Issue related to ARC (dependency injection) area/gradle Gradle area/kotlin kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants