You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Ephemeris Lappis <ep...@gmail.com> on 2022/12/06 15:44:07 UTC

Component master with Camel 3.18.4

Hello.

I'm testing Camel routes that work as expected with Camel 2.25 and
fail with Camel 3.18, both running on Karaf 4.4.2.

I have a very strange behavior with the component "master". I create a
File Lock instance of CamelClusterService and expose it as a service
in a bundle. Then another bundle with a blueprint containing the Camel
context gets a reference on the service to provide it for master
endpoints.

When the context is built, first logs say that the service is used and
even that two instances (the same twice) are resolved :
16:29:27.218 INFO [Blueprint Extender: 3] Using CamelClusterService
with id: null and implementation:
org.apache.camel.component.file.cluster.FileLockClusterService@2b6df8e6
16:29:27.220 INFO [Blueprint Extender: 3] Using CamelClusterService
with id: null and implementation:
org.apache.camel.component.file.cluster.FileLockClusterService@2b6df8e6
16:29:27.535 WARN [Blueprint Event Dispatcher: 1] Multiple
CamelClusterService instances available
(items=[org.apache.camel.component.file.cluster.FileLockClusterService@2b6df8e6,
org.apache.camel.component.file.cluster.FileLockClusterService@2b6df8e6])

But when the context is supposed to start, an error says that no
service is found :
16:29:27.552 ERROR [Blueprint Event Dispatcher: 1] Error occurred
during starting CamelContext: KT1
org.apache.camel.FailedToCreateRouteException: Failed to create route
KT1-File: Route(KT1-File)[From[master:K1-FILE:file://{{my.input-folder...
because of Failed to resolve endpoint:
master://K1-FILE:file:///SHARE/data/input?delete=true&moveFailed=.ERROR
due to: No cluster service found
        at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:81)
~[?:?]
        at org.apache.camel.impl.DefaultModelReifierFactory.createRoute(DefaultModelReifierFactory.java:49)
~[?:?]
        at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:878)
~[?:?]
        at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:766)
~[?:?]
        at org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:2947)
~[?:?]
        at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
~[?:?]
        at org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2630)
~[?:?]
        at org.apache.camel.support.service.BaseService.start(BaseService.java:111)
~[?:?]
        at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2649)
~[?:?]
        at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:262)
~[?:?]
        at org.apache.camel.blueprint.BlueprintCamelContext.start(BlueprintCamelContext.java:241)
~[?:?]
        at org.apache.camel.blueprint.BlueprintCamelContext.maybeStart(BlueprintCamelContext.java:283)
~[?:?]
        at org.apache.camel.blueprint.BlueprintCamelContext.blueprintEvent(BlueprintCamelContext.java:188)
~[?:?]
        at org.apache.aries.blueprint.container.BlueprintEventDispatcher$3.call(BlueprintEventDispatcher.java:197)
~[?:?]
        at org.apache.aries.blueprint.container.BlueprintEventDispatcher$3.call(BlueprintEventDispatcher.java:195)
~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
~[?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
~[?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
~[?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
~[?:?]
        at java.lang.Thread.run(Thread.java:829) ~[?:?]

I attach the 2 blueprints with the service creation and the routes...

Some idea of what changes between Camel versions for "master" ?

Thanks for your help.

Regards.

Re: Component master with Camel 3.18.4

Posted by Ephemeris Lappis <ep...@gmail.com>.
Hello and sorry again.

After more tests, I have new details about the strange behaviors of my routes...

First, if I remove both the service reference and bean for the
CamelClusterService, it seems that Camel automatically gets the
service instance on the global Karaf context. Is it a new "normal"
behavior, and does it mean that all the OSGi services are
automatically in the scope of all the Camel contexts ?

Then, when I remove the property on the file route, a new error breaks
the context on the "transacted" element with an error "policy must be
specified on: org.apache.camel.reifier.TransactedReifier". The Karaf
feature that I use to install the routes and all the dependent
features works as is with Camel 2.25. What is new in camel 3.x for
transacted routes ?

And finally, if I comment the "transacted" (what is an issue since I
need transactions for my JMS and JDBC endpoints), the routes start,
but it fails when executed with this log :

org.apache.camel.component.bean.AmbiguousMethodCallException:
Ambiguous method invocations possible: [public abstract
java.lang.String my.test.t26.helper.Helper.help(java.lang.String),
public abstract java.lang.String
my.test.t26.helper.Helper.help(java.lang.String)] on the exchange:
Exchange[075D67C4FC25E60-000000000000000D]

Could it be because the service and its reference are both in the
context, despite the explicit name of the bean that is supposed to be
local for my context : <to uri="bean:myHelper" /> ?

Thanks again.

Regards.

Le mar. 6 déc. 2022 à 18:42, Ephemeris Lappis
<ep...@gmail.com> a écrit :
>
> Hello.
>
> Sorry to post an answer to my own mail...
>
> It seems that the OSGi property placeholders of my blueprints are not
> taken into account.
>
> I've tested changing the reference of the CamelClusterService with a
> bean, and now the route starting fails with a log that lets me think
> that the properties are not resolved.
>
> Failed to create route KT1-File:
> Route(KT1-File)[From[master:K1-FILE:file://{{my.input-folder...
> because of Failed to resolve endpoint:
> master:K1-FILE:file://{{my.input-folder}}?delete=true&moveFailed=.ERROR
> due to: Property with key [my.input-folder] not found in properties
> from text: master:K1-FILE:file://{{my.input-folder}}?delete=true&moveFailed=.ERROR
>
> When I check the OSGi configuration, the CFG file seems to be read :
> karaf@root()> config:edit my_test_26_karaf_2_routes
> karaf@root()> config:property-list
>    my.input-folder = /SHARE/data/input
>
> I always used OSGi configuration place holders to set properties on
> Camel routes with versions 2.x. Is it working the same way on Camel
> 3.x ?
>
> Thanks again.
>
> Regards.
>
> Le mar. 6 déc. 2022 à 16:44, Ephemeris Lappis
> <ep...@gmail.com> a écrit :
> >
> > Hello.
> >
> > I'm testing Camel routes that work as expected with Camel 2.25 and
> > fail with Camel 3.18, both running on Karaf 4.4.2.
> >
> > I have a very strange behavior with the component "master". I create a
> > File Lock instance of CamelClusterService and expose it as a service
> > in a bundle. Then another bundle with a blueprint containing the Camel
> > context gets a reference on the service to provide it for master
> > endpoints.
> >
> > When the context is built, first logs say that the service is used and
> > even that two instances (the same twice) are resolved :
> > 16:29:27.218 INFO [Blueprint Extender: 3] Using CamelClusterService
> > with id: null and implementation:
> > org.apache.camel.component.file.cluster.FileLockClusterService@2b6df8e6
> > 16:29:27.220 INFO [Blueprint Extender: 3] Using CamelClusterService
> > with id: null and implementation:
> > org.apache.camel.component.file.cluster.FileLockClusterService@2b6df8e6
> > 16:29:27.535 WARN [Blueprint Event Dispatcher: 1] Multiple
> > CamelClusterService instances available
> > (items=[org.apache.camel.component.file.cluster.FileLockClusterService@2b6df8e6,
> > org.apache.camel.component.file.cluster.FileLockClusterService@2b6df8e6])
> >
> > But when the context is supposed to start, an error says that no
> > service is found :
> > 16:29:27.552 ERROR [Blueprint Event Dispatcher: 1] Error occurred
> > during starting CamelContext: KT1
> > org.apache.camel.FailedToCreateRouteException: Failed to create route
> > KT1-File: Route(KT1-File)[From[master:K1-FILE:file://{{my.input-folder...
> > because of Failed to resolve endpoint:
> > master://K1-FILE:file:///SHARE/data/input?delete=true&moveFailed=.ERROR
> > due to: No cluster service found
> >         at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:81)
> > ~[?:?]
> >         at org.apache.camel.impl.DefaultModelReifierFactory.createRoute(DefaultModelReifierFactory.java:49)
> > ~[?:?]
> >         at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:878)
> > ~[?:?]
> >         at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:766)
> > ~[?:?]
> >         at org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:2947)
> > ~[?:?]
> >         at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
> > ~[?:?]
> >         at org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2630)
> > ~[?:?]
> >         at org.apache.camel.support.service.BaseService.start(BaseService.java:111)
> > ~[?:?]
> >         at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2649)
> > ~[?:?]
> >         at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:262)
> > ~[?:?]
> >         at org.apache.camel.blueprint.BlueprintCamelContext.start(BlueprintCamelContext.java:241)
> > ~[?:?]
> >         at org.apache.camel.blueprint.BlueprintCamelContext.maybeStart(BlueprintCamelContext.java:283)
> > ~[?:?]
> >         at org.apache.camel.blueprint.BlueprintCamelContext.blueprintEvent(BlueprintCamelContext.java:188)
> > ~[?:?]
> >         at org.apache.aries.blueprint.container.BlueprintEventDispatcher$3.call(BlueprintEventDispatcher.java:197)
> > ~[?:?]
> >         at org.apache.aries.blueprint.container.BlueprintEventDispatcher$3.call(BlueprintEventDispatcher.java:195)
> > ~[?:?]
> >         at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
> >         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
> > ~[?:?]
> >         at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
> >         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
> > ~[?:?]
> >         at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
> >         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
> > ~[?:?]
> >         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> > ~[?:?]
> >         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> > ~[?:?]
> >         at java.lang.Thread.run(Thread.java:829) ~[?:?]
> >
> > I attach the 2 blueprints with the service creation and the routes...
> >
> > Some idea of what changes between Camel versions for "master" ?
> >
> > Thanks for your help.
> >
> > Regards.

Re: Component master with Camel 3.18.4

Posted by Ephemeris Lappis <ep...@gmail.com>.
Hello.

Sorry to post an answer to my own mail...

It seems that the OSGi property placeholders of my blueprints are not
taken into account.

I've tested changing the reference of the CamelClusterService with a
bean, and now the route starting fails with a log that lets me think
that the properties are not resolved.

Failed to create route KT1-File:
Route(KT1-File)[From[master:K1-FILE:file://{{my.input-folder...
because of Failed to resolve endpoint:
master:K1-FILE:file://{{my.input-folder}}?delete=true&moveFailed=.ERROR
due to: Property with key [my.input-folder] not found in properties
from text: master:K1-FILE:file://{{my.input-folder}}?delete=true&moveFailed=.ERROR

When I check the OSGi configuration, the CFG file seems to be read :
karaf@root()> config:edit my_test_26_karaf_2_routes
karaf@root()> config:property-list
   my.input-folder = /SHARE/data/input

I always used OSGi configuration place holders to set properties on
Camel routes with versions 2.x. Is it working the same way on Camel
3.x ?

Thanks again.

Regards.

Le mar. 6 déc. 2022 à 16:44, Ephemeris Lappis
<ep...@gmail.com> a écrit :
>
> Hello.
>
> I'm testing Camel routes that work as expected with Camel 2.25 and
> fail with Camel 3.18, both running on Karaf 4.4.2.
>
> I have a very strange behavior with the component "master". I create a
> File Lock instance of CamelClusterService and expose it as a service
> in a bundle. Then another bundle with a blueprint containing the Camel
> context gets a reference on the service to provide it for master
> endpoints.
>
> When the context is built, first logs say that the service is used and
> even that two instances (the same twice) are resolved :
> 16:29:27.218 INFO [Blueprint Extender: 3] Using CamelClusterService
> with id: null and implementation:
> org.apache.camel.component.file.cluster.FileLockClusterService@2b6df8e6
> 16:29:27.220 INFO [Blueprint Extender: 3] Using CamelClusterService
> with id: null and implementation:
> org.apache.camel.component.file.cluster.FileLockClusterService@2b6df8e6
> 16:29:27.535 WARN [Blueprint Event Dispatcher: 1] Multiple
> CamelClusterService instances available
> (items=[org.apache.camel.component.file.cluster.FileLockClusterService@2b6df8e6,
> org.apache.camel.component.file.cluster.FileLockClusterService@2b6df8e6])
>
> But when the context is supposed to start, an error says that no
> service is found :
> 16:29:27.552 ERROR [Blueprint Event Dispatcher: 1] Error occurred
> during starting CamelContext: KT1
> org.apache.camel.FailedToCreateRouteException: Failed to create route
> KT1-File: Route(KT1-File)[From[master:K1-FILE:file://{{my.input-folder...
> because of Failed to resolve endpoint:
> master://K1-FILE:file:///SHARE/data/input?delete=true&moveFailed=.ERROR
> due to: No cluster service found
>         at org.apache.camel.reifier.RouteReifier.createRoute(RouteReifier.java:81)
> ~[?:?]
>         at org.apache.camel.impl.DefaultModelReifierFactory.createRoute(DefaultModelReifierFactory.java:49)
> ~[?:?]
>         at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:878)
> ~[?:?]
>         at org.apache.camel.impl.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:766)
> ~[?:?]
>         at org.apache.camel.impl.engine.AbstractCamelContext.doInit(AbstractCamelContext.java:2947)
> ~[?:?]
>         at org.apache.camel.support.service.BaseService.init(BaseService.java:83)
> ~[?:?]
>         at org.apache.camel.impl.engine.AbstractCamelContext.init(AbstractCamelContext.java:2630)
> ~[?:?]
>         at org.apache.camel.support.service.BaseService.start(BaseService.java:111)
> ~[?:?]
>         at org.apache.camel.impl.engine.AbstractCamelContext.start(AbstractCamelContext.java:2649)
> ~[?:?]
>         at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:262)
> ~[?:?]
>         at org.apache.camel.blueprint.BlueprintCamelContext.start(BlueprintCamelContext.java:241)
> ~[?:?]
>         at org.apache.camel.blueprint.BlueprintCamelContext.maybeStart(BlueprintCamelContext.java:283)
> ~[?:?]
>         at org.apache.camel.blueprint.BlueprintCamelContext.blueprintEvent(BlueprintCamelContext.java:188)
> ~[?:?]
>         at org.apache.aries.blueprint.container.BlueprintEventDispatcher$3.call(BlueprintEventDispatcher.java:197)
> ~[?:?]
>         at org.apache.aries.blueprint.container.BlueprintEventDispatcher$3.call(BlueprintEventDispatcher.java:195)
> ~[?:?]
>         at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
>         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
> ~[?:?]
>         at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
>         at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
> ~[?:?]
>         at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
>         at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
> ~[?:?]
>         at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
> ~[?:?]
>         at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
> ~[?:?]
>         at java.lang.Thread.run(Thread.java:829) ~[?:?]
>
> I attach the 2 blueprints with the service creation and the routes...
>
> Some idea of what changes between Camel versions for "master" ?
>
> Thanks for your help.
>
> Regards.