tadayosi opened a new issue, #6880:
URL: https://github.com/apache/camel-quarkus/issues/6880

   ### Bug description
   
   The cxf-soap example uses `@SessionScoped` for the creation of CXF endpoints 
in its route builder classes:
   
https://github.com/apache/camel-quarkus-examples/blob/4c399bda9d5515465097df8074c57a79ad792260/cxf-soap/src/main/java/org/acme/cxf/soap/pojo/MyPojoRouteBuilder.java#L33-L42
   but it seems `@ApplicationScoped` is just fine for them. Is there a strong 
reason to use `@SessionScoped`?
   
   The example works as-is, but I found a problem with `@SessionScoped` as soon 
as you attach the [Hawtio console](https://hawt.io/) with the example app.
   https://hawt.io/docs/get-started.html#_running_a_quarkus_app
   ```
   ERROR [org.apa.cam.qua.mai.CamelMainRuntime] (Quarkus Main Thread) Failed to 
start application: org.apache.camel.FailedToCreateRouteException: Failed to 
create route route1: Route(route1)[From[cxf:bean:contact] -> 
[RecipientList[simpl... because of Failed to resolve endpoint: 
cxf://bean:contact due to: SessionScoped context was not active when trying to 
obtain a bean instance for a client proxy of PRODUCER_METHOD bean 
[class=org.acme.cxf.soap.pojo.MyPojoRouteBuilder, 
id=AOwW58TCGFzUteh-DoVlksWwEZg]
        at 
org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:92)
        at 
org.apache.camel.impl.DefaultModelReifierFactory.createRoute(DefaultModelReifierFactory.java:49)
        at 
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:726)
        at 
org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:592)
        at 
org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:2457)
        at 
org.apache.camel.quarkus.core.FastCamelContext.doInit(FastCamelContext.java:195)
        at 
org.apache.camel.support.service.BaseService.init(BaseService.java:85)
        at 
org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2087)
        at 
org.apache.camel.support.service.BaseService.start(BaseService.java:115)
        at 
org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2106)
        at 
org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:211)
        at org.apache.camel.quarkus.main.CamelMain.doStart(CamelMain.java:91)
        at 
org.apache.camel.support.service.BaseService.start(BaseService.java:123)
        at 
org.apache.camel.quarkus.main.CamelMain.startEngine(CamelMain.java:137)
        at 
org.apache.camel.quarkus.main.CamelMainRuntime.start(CamelMainRuntime.java:49)
        at 
org.apache.camel.quarkus.core.CamelBootstrapRecorder.start(CamelBootstrapRecorder.java:47)
        at 
io.quarkus.deployment.steps.CamelBootstrapProcessor$boot548544167.deploy_0(Unknown
 Source)
        at 
io.quarkus.deployment.steps.CamelBootstrapProcessor$boot548544167.deploy(Unknown
 Source)
        at io.quarkus.runner.ApplicationImpl.doStart(Unknown Source)
        at io.quarkus.runtime.Application.start(Application.java:101)
        at 
io.quarkus.runtime.ApplicationLifecycleManager.run(ApplicationLifecycleManager.java:121)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:71)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:44)
        at io.quarkus.runtime.Quarkus.run(Quarkus.java:124)
        at io.quarkus.runner.GeneratedMain.main(Unknown Source)
        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:569)
        at 
io.quarkus.runner.bootstrap.StartupActionImpl$1.run(StartupActionImpl.java:116)
        at java.base/java.lang.Thread.run(Thread.java:840)
   Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to 
resolve endpoint: cxf://bean:contact due to: SessionScoped context was not 
active when trying to obtain a bean instance for a client proxy of 
PRODUCER_METHOD bean [class=org.acme.cxf.soap.pojo.MyPojoRouteBuilder, 
id=AOwW58TCGFzUteh-DoVlksWwEZg]
        at 
org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:841)
        at 
org.apache.camel.impl.engine.AbstractCamelContext.getEndpoint(AbstractCamelContext.java:741)
        at 
org.apache.camel.support.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:66)
        at 
org.apache.camel.reifier.AbstractReifier.resolveEndpoint(AbstractReifier.java:199)
        at 
org.apache.camel.reifier.RouteReifier.doCreateRoute(RouteReifier.java:106)
        at 
org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:86)
        ... 30 more
   Caused by: jakarta.enterprise.context.ContextNotActiveException: 
SessionScoped context was not active when trying to obtain a bean instance for 
a client proxy of PRODUCER_METHOD bean 
[class=org.acme.cxf.soap.pojo.MyPojoRouteBuilder, 
id=AOwW58TCGFzUteh-DoVlksWwEZg]
        at io.quarkus.arc.impl.ClientProxies.notActive(ClientProxies.java:70)
        at 
io.quarkus.arc.impl.ClientProxies.getSingleContextDelegate(ClientProxies.java:30)
        at 
org.apache.camel.component.cxf.jaxws.MyPojoRouteBuilder_ProducerMethod_contact_Aliui1rd7zHY5iWLEtLpnlyzZ2E_ClientProxy.arc$delegate(Unknown
 Source)
        at 
org.apache.camel.component.cxf.jaxws.MyPojoRouteBuilder_ProducerMethod_contact_Aliui1rd7zHY5iWLEtLpnlyzZ2E_ClientProxy.setBeanId(Unknown
 Source)
        at 
org.apache.camel.component.cxf.jaxws.CxfComponent.createSpringContextEndpoint(CxfComponent.java:152)
        at 
org.apache.camel.component.cxf.jaxws.CxfComponent.createCxfEndpoint(CxfComponent.java:135)
        at 
org.apache.camel.component.cxf.jaxws.CxfComponent.createEndpoint(CxfComponent.java:112)
        at 
org.apache.camel.support.DefaultComponent.createEndpoint(DefaultComponent.java:171)
        at 
org.apache.camel.impl.engine.AbstractCamelContext.doGetEndpoint(AbstractCamelContext.java:807)
        ... 35 more
   ```
   The issue can be resolved if we remove `@SessionScoped` or change it to 
`@ApplicationScoped`.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to