quarkiverse / quarkus-cxf

Quarkus CXF Extension to support SOAP based web services.
Apache License 2.0
71 stars 57 forks source link

Beans not injected into a service impl with `@CXFEndpoint("/my-path")` #1399

Closed Inithron closed 1 month ago

Inithron commented 1 month ago

Today I did the update to quarkus-cxf 3.11.0 and every thing runs fine. Then I removed quarkus.cxf.endpoint."/my-path".implementor from the properties file and added the new annotation @CXFEndpoint("/my-path") to my service. After that all unit tests was failing because the injected beans in my service was null.

ppalaga commented 1 month ago

Thanks for the feedback, @Inithron! I wonder how your use case differs from our test? https://github.com/quarkiverse/quarkus-cxf/blob/5217d7aaa6b259d35c4b162fe58ba999de098150/integration-tests/client-server/src/main/java/io/quarkiverse/cxf/it/annotation/cxfendpoint/PathAnnotationHelloServiceImpl.java#L8 Would you sketch some steps to reproduce or even better post a minimal reproducer?

Inithron commented 1 month ago

Wow, that was a fast response :) I have a complex service with many methods. To keep the service itself small and clear I moved the functionality in other classes and inject them with the @Inject annotation.

To reproduce the NullPointerException it should be sufficient to create a new class returning the response string and inject this class in the PathAnnotationHelloServiceImpl.

ppalaga commented 1 month ago

Thanks, I can reproduce.

ppalaga commented 1 month ago

For the record, the stack trace is

WARN  [org.apa.cxf.pha.PhaseInterceptorChain] (executor-thread-1) Application {https://quarkiverse.github.io/quarkiverse-docs/quarkus-cxf/test}HelloService#{https://quarkiverse.github.io/quarkiverse-docs/quarkus-cxf/test}hello has thrown exception, unwinding now: org.apache.cxf.interceptor.Fault: Cannot invoke "io.quarkiverse.cxf.it.annotation.cxfendpoint.HelloBean.hello(String)" because "this.helloBean" is null
[INFO] [stdout]         at org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:162)
[INFO] [stdout]         at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.createFault(AbstractJAXWSMethodInvoker.java:266)
[INFO] [stdout]         at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:128)
[INFO] [stdout]         at org.apache.cxf.jaxws.AbstractJAXWSMethodInvoker.invoke(AbstractJAXWSMethodInvoker.java:231)
[INFO] [stdout]         at org.apache.cxf.jaxws.JAXWSMethodInvoker.invoke(JAXWSMethodInvoker.java:84)
[INFO] [stdout]         at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:74)
[INFO] [stdout]         at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:59)
[INFO] [stdout]         at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
[INFO] [stdout]         at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
[INFO] [stdout]         at org.apache.cxf.interceptor.ServiceInvokerInterceptor$2.run(ServiceInvokerInterceptor.java:126)
[INFO] [stdout]         at org.apache.cxf.workqueue.SynchronousExecutor.execute(SynchronousExecutor.java:37)
[INFO] [stdout]         at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:131)
[INFO] [stdout]         at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
[INFO] [stdout]         at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
[INFO] [stdout]         at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:265)
[INFO] [stdout]         at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:233)
[INFO] [stdout]         at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:207)
[INFO] [stdout]         at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:159)
[INFO] [stdout]         at io.quarkiverse.cxf.transport.CxfHandler.process(CxfHandler.java:248)
[INFO] [stdout]         at io.quarkiverse.cxf.transport.CxfHandler.handle(CxfHandler.java:185)
[INFO] [stdout]         at io.quarkiverse.cxf.transport.CxfHandler.handle(CxfHandler.java:50)
[INFO] [stdout]         at io.vertx.ext.web.impl.BlockingHandlerDecorator.lambda$handle$0(BlockingHandlerDecorator.java:48)
[INFO] [stdout]         at io.vertx.core.impl.ContextImpl.lambda$executeBlocking$1(ContextImpl.java:191)
[INFO] [stdout]         at io.vertx.core.impl.ContextInternal.dispatch(ContextInternal.java:279)
[INFO] [stdout]         at io.vertx.core.impl.ContextImpl.lambda$internalExecuteBlocking$2(ContextImpl.java:210)
[INFO] [stdout]         at io.quarkus.vertx.core.runtime.VertxCoreRecorder$14.runWith(VertxCoreRecorder.java:599)
[INFO] [stdout]         at org.jboss.threads.EnhancedQueueExecutor$Task.doRunWith(EnhancedQueueExecutor.java:2516)
[INFO] [stdout]         at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2495)
[INFO] [stdout]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1521)
[INFO] [stdout]         at org.jboss.threads.DelegatingRunnable.run(DelegatingRunnable.java:11)
[INFO] [stdout]         at org.jboss.threads.ThreadLocalResettingRunnable.run(ThreadLocalResettingRunnable.java:11)
[INFO] [stdout]         at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
[INFO] [stdout]         at java.base/java.lang.Thread.run(Thread.java:1583)
[INFO] [stdout] Caused by: java.lang.NullPointerException: Cannot invoke "io.quarkiverse.cxf.it.annotation.cxfendpoint.HelloBean.hello(String)" because "this.helloBean" is null
[INFO] [stdout]         at io.quarkiverse.cxf.it.annotation.cxfendpoint.PathAnnotationHelloServiceWithBean.hello(PathAnnotationHelloServiceWithBean.java:20)
[INFO] [stdout]         at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
[INFO] [stdout]         at java.base/java.lang.reflect.Method.invoke(Method.java:580)
[INFO] [stdout]         at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:179)
[INFO] [stdout]         at org.apache.cxf.jaxws.JAXWSMethodInvoker.performInvocation(JAXWSMethodInvoker.java:65)
[INFO] [stdout]         at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:96)
[INFO] [stdout]         ... 30 more
Inithron commented 1 month ago

Is there a possibility to see in GitHub with which version the bug fix will be delivered, or to see in already delivered bug fixes in wich version they was delivered?

The only thing I found was this link: https://stackoverflow.com/a/73771899. But in the commits of this repository are no tags.

ppalaga commented 1 month ago

For released fixes, you can find the commit and check the newest tag it is available in. E.g. for https://github.com/quarkiverse/quarkus-cxf/commit/03f1a414361e2d38a6aec202505947cde29f86b8 it is 3.11.0 image

There is no good way for unreleased fixes unless we set the milestone for the issue, which I must admit we are not particularly good at.