Peter Palaga created CXF-8968:
---------------------------------

             Summary: OpenTelemetryClientFeature cannot be used a CDI bean 
without the no-args constructor
                 Key: CXF-8968
                 URL: https://issues.apache.org/jira/browse/CXF-8968
             Project: CXF
          Issue Type: Bug
    Affects Versions: 4.0.3
            Reporter: Peter Palaga


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:

{code}
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)
{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to