Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-8968

OpenTelemetryClientFeature cannot be used as a CDI bean unless it has a no-args constructor

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 4.0.3
    • 3.5.8, 3.6.3, 4.0.4
    • None
    • None
    • Unknown

    Description

      I am playing with the new OpenTelemetryClientFeature on Quarkus, where we typically produce CXF features as CDI beans. Quarkus CDI implementation does not allow beans of type OpenTelemetryClientFeature, because the class does not have the no-args constructor.

      We just need to add the default constructor, much like we already have it in OpenTelemetryFeature.

      A PR follows.

      For the sake of completeness here is the stack trace:

      java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
              [error]: Build step io.quarkus.arc.deployment.ArcProcessor#generateResources threw an exception: jakarta.enterprise.inject.spi.DeploymentException: It's not possible to automatically add a synthetic no-args constructor to an unproxyable bean class. You need to manually add a non-private no-args constructor to io.quarkiverse.cxf.opentelemetry.it.BeanProducers$QuarkusOpenTelemetryClientFeature in order to fulfill the requirements for normal scoped/intercepted/decorated beans.
              at io.quarkus.arc.processor.Beans.cannotAddSyntheticNoArgsConstructor(Beans.java:958)
              at io.quarkus.arc.processor.Beans.validateBean(Beans.java:857)
              at io.quarkus.arc.processor.BeanInfo.validate(BeanInfo.java:605)
              at io.quarkus.arc.processor.BeanDeployment.validateBeans(BeanDeployment.java:1565)
              at io.quarkus.arc.processor.BeanDeployment.validate(BeanDeployment.java:482)
              at io.quarkus.arc.processor.BeanProcessor.validate(BeanProcessor.java:169)
              at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:474)
              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$3.execute(ExtensionLoader.java:849)
              at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
              at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
              at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
              at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
              at java.base/java.lang.Thread.run(Thread.java:840)
              at org.jboss.threads.JBossThread.run(JBossThread.java:501)
      
              at io.quarkus.test.junit.QuarkusTestExtension.throwBootFailureException(QuarkusTestExtension.java:638)
              at io.quarkus.test.junit.QuarkusTestExtension.interceptTestClassConstructor(QuarkusTestExtension.java:722)
              at java.base/java.util.Optional.orElseGet(Optional.java:364)
              at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
              at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
      Caused by: java.lang.RuntimeException: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
              [error]: Build step io.quarkus.arc.deployment.ArcProcessor#generateResources threw an exception: jakarta.enterprise.inject.spi.DeploymentException: It's not possible to automatically add a synthetic no-args constructor to an unproxyable bean class. You need to manually add a non-private no-args constructor to io.quarkiverse.cxf.opentelemetry.it.BeanProducers$QuarkusOpenTelemetryClientFeature in order to fulfill the requirements for normal scoped/intercepted/decorated beans.
              at io.quarkus.arc.processor.Beans.cannotAddSyntheticNoArgsConstructor(Beans.java:958)
              at io.quarkus.arc.processor.Beans.validateBean(Beans.java:857)
              at io.quarkus.arc.processor.BeanInfo.validate(BeanInfo.java:605)
              at io.quarkus.arc.processor.BeanDeployment.validateBeans(BeanDeployment.java:1565)
              at io.quarkus.arc.processor.BeanDeployment.validate(BeanDeployment.java:482)
              at io.quarkus.arc.processor.BeanProcessor.validate(BeanProcessor.java:169)
              at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:474)
              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$3.execute(ExtensionLoader.java:849)
              at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
              at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
              at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
              at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
              at java.base/java.lang.Thread.run(Thread.java:840)
              at org.jboss.threads.JBossThread.run(JBossThread.java:501)
      
              at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:334)
              at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:251)
              at io.quarkus.runner.bootstrap.AugmentActionImpl.createInitialRuntimeApplication(AugmentActionImpl.java:60)
              at io.quarkus.test.junit.QuarkusTestExtension.doJavaStart(QuarkusTestExtension.java:224)
              at io.quarkus.test.junit.QuarkusTestExtension.ensureStarted(QuarkusTestExtension.java:605)
              at io.quarkus.test.junit.QuarkusTestExtension.beforeAll(QuarkusTestExtension.java:655)
              ... 1 more
      Caused by: io.quarkus.builder.BuildException: Build failure: Build failed due to errors
              [error]: Build step io.quarkus.arc.deployment.ArcProcessor#generateResources threw an exception: jakarta.enterprise.inject.spi.DeploymentException: It's not possible to automatically add a synthetic no-args constructor to an unproxyable bean class. You need to manually add a non-private no-args constructor to io.quarkiverse.cxf.opentelemetry.it.BeanProducers$QuarkusOpenTelemetryClientFeature in order to fulfill the requirements for normal scoped/intercepted/decorated beans.
              at io.quarkus.arc.processor.Beans.cannotAddSyntheticNoArgsConstructor(Beans.java:958)
              at io.quarkus.arc.processor.Beans.validateBean(Beans.java:857)
              at io.quarkus.arc.processor.BeanInfo.validate(BeanInfo.java:605)
              at io.quarkus.arc.processor.BeanDeployment.validateBeans(BeanDeployment.java:1565)
              at io.quarkus.arc.processor.BeanDeployment.validate(BeanDeployment.java:482)
              at io.quarkus.arc.processor.BeanProcessor.validate(BeanProcessor.java:169)
              at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:474)
              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$3.execute(ExtensionLoader.java:849)
              at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
              at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
              at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
              at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
              at java.base/java.lang.Thread.run(Thread.java:840)
              at org.jboss.threads.JBossThread.run(JBossThread.java:501)
      
              at io.quarkus.builder.Execution.run(Execution.java:123)
              at io.quarkus.builder.BuildExecutionBuilder.execute(BuildExecutionBuilder.java:79)
              at io.quarkus.deployment.QuarkusAugmentor.run(QuarkusAugmentor.java:160)
              at io.quarkus.runner.bootstrap.AugmentActionImpl.runAugment(AugmentActionImpl.java:330)
              ... 6 more
      Caused by: jakarta.enterprise.inject.spi.DeploymentException: It's not possible to automatically add a synthetic no-args constructor to an unproxyable bean class. You need to manually add a non-private no-args constructor to io.quarkiverse.cxf.opentelemetry.it.BeanProducers$QuarkusOpenTelemetryClientFeature in order to fulfill the requirements for normal scoped/intercepted/decorated beans.
              at io.quarkus.arc.processor.Beans.cannotAddSyntheticNoArgsConstructor(Beans.java:958)
              at io.quarkus.arc.processor.Beans.validateBean(Beans.java:857)
              at io.quarkus.arc.processor.BeanInfo.validate(BeanInfo.java:605)
              at io.quarkus.arc.processor.BeanDeployment.validateBeans(BeanDeployment.java:1565)
              at io.quarkus.arc.processor.BeanDeployment.validate(BeanDeployment.java:482)
              at io.quarkus.arc.processor.BeanProcessor.validate(BeanProcessor.java:169)
              at io.quarkus.arc.deployment.ArcProcessor.validate(ArcProcessor.java:474)
              at java.base/java.lang.reflect.Method.invoke(Method.java:568)
              at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:849)
              at io.quarkus.builder.BuildContext.run(BuildContext.java:256)
              at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
              at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
              at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
              at java.base/java.lang.Thread.run(Thread.java:840)
              at org.jboss.threads.JBossThread.run(JBossThread.java:501)
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ppalaga Peter Palaga
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: