You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by "Calvert, Zach (Zach)** CTR **" <zc...@motive.com> on 2013/10/30 22:44:31 UTC

Component Resolution, Camel/SMX Race Condition?

This is somewhat of a cross post between here and the ApacheServiceMix mailing list, but I'm thinking I should have fired this email to camel in the first place.  I apologize for the cross post in advance.

I'm making use of the cxfbean component in Apache ServiceMix 4.5.3.  I have reviewed the source and OSGI services being exposed here to try to get around the race condition I am experiencing, but while the service is up and running, ServiceMix/Camel does not yet recognize the component and I'm not sure who to direct this question/problem to.

Breakdown:
I have a bundle which has the following route:

        <camel:route>
            <camel:from uri="jetty:
http://0.0.0.0:9089/health/?matchOnUriPrefix=true" />
            <camel:to uri="cxfbean:healthService" />
        </camel:route>

The health service implementation is a standard javax.ws.rs annotated class.  The cxfbean component is exposed in the camel-cxf feature under the camel-cxf-2.10.7 bundle (I have confirmed).  To try to enforce that the cxfbean service really, really is running, I have added
<osgi:reference id="cxfbeanReference" cardinality="1..1"
interface="org.apache.camel.spi.ComponentResolver"
filter="(component=cxfbean)" />
to my bundle.  This osgi reference is met and fully populated, however I still get
"----
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create
route route1 at: >>> To[cxfbean:healthService] <<< in route:
Route[[From[jetty:http://0.0.0.0:9089... because of Failed to resolve
endpoint: cxfbean://healthService due to: No component found with scheme:
cxfbean
---"
in my ServiceMix startup.  Note that this bundle is deployed in the
apache-servicemix-4.5.3/deploy directory on a Linux machine.

This issue can be resolved simply by waiting for ServiceMix to be started
for a few minutes and then run
touch ./apache-servicemix-4.5.3/deploy/ecs.bundles.health-2.3.0.25-SNAPSHOT.jar

I would like to have the bundle block until the "cxfbean" component is fully started.  Again this is a race condition and functionality is fully restored by waiting a couple of minutes and then running touch on the bundle that exposes this camel route.

Is there a way to say "Really wait on starting this bundle until the cxfbean component is fully started and ready to go"?


Thank you,
Zach Calvert


RE: Component Resolution, Camel/SMX Race Condition?

Posted by "Calvert, Zach (Zach)** CTR **" <zc...@motive.com>.
I created 
https://issues.apache.org/jira/browse/CAMEL-6920
documenting the steps to reproduce this issue, as well as my attempts to work around the race condition.



Thanks,
Zach Calvert


-----Original Message-----
From: Calvert, Zach (Zach)** CTR ** [mailto:zcalvert@motive.com] 
Sent: Thursday, October 31, 2013 9:29 AM
To: users@camel.apache.org
Subject: RE: Component Resolution, Camel/SMX Race Condition?

Hi Willem,
Thank you for the help, unfortunately it did not solve the problem.  I have confirmed I have my MANIFEST.MF updated to include:
"
Import-Package: javax.ws.rs,javax.ws.rs.core,javax.xml.bind,javax.xml.bi
 nd.annotation,org.apache.camel.component.cxf.cxfbean,org.apache.commons
 .httpclient,org.apache.commons.httpclient.methods,org.eclipse.jetty.htt
 p,org.springframework.beans.factory.config
Require-Bundle: org.apache.camel.camel-cxf
Tool: Bnd-1.50.0
"

This still does not solve our problem.   I will create a sample bundle as a sub example of the examples project in 4.5.3 and submit a bug against ServiceMix since I think it may be in the framework.



Zach Calvert


-----Original Message-----
From: Willem jiang [mailto:willem.jiang@gmail.com]
Sent: Wednesday, October 30, 2013 9:45 PM
To: users@camel.apache.org
Subject: Re: Component Resolution, Camel/SMX Race Condition?

As the cxfbeanReference wasn’t used by Camel as an OSGi service, so you setting cannot block the loading of the CamelContext.
How about adding the Required-Bundle of camel-cxf in your application bundle?


--
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem





On Thursday, October 31, 2013 at 5:44 AM, Calvert, Zach (Zach)** CTR ** wrote:

> This is somewhat of a cross post between here and the ApacheServiceMix mailing list, but I'm thinking I should have fired this email to camel in the first place. I apologize for the cross post in advance.
>  
> I'm making use of the cxfbean component in Apache ServiceMix 4.5.3. I have reviewed the source and OSGI services being exposed here to try to get around the race condition I am experiencing, but while the service is up and running, ServiceMix/Camel does not yet recognize the component and I'm not sure who to direct this question/problem to.
>  
> Breakdown:
> I have a bundle which has the following route:
>  
> <camel:route>
> <camel:from uri="jetty:
> http://0.0.0.0:9089/health/?matchOnUriPrefix=true" /> <camel:to 
> uri="cxfbean:healthService" /> </camel:route>
>  
> The health service implementation is a standard javax.ws.rs annotated 
> class. The cxfbean component is exposed in the camel-cxf feature under the camel-cxf-2.10.7 bundle (I have confirmed). To try to enforce that the cxfbean service really, really is running, I have added <osgi:reference id="cxfbeanReference" cardinality="1..1"
> interface="org.apache.camel.spi.ComponentResolver"
> filter="(component=cxfbean)" />
> to my bundle. This osgi reference is met and fully populated, however 
> I still get
> "----
> Caused by: org.apache.camel.FailedToCreateRouteException: Failed to 
> create route route1 at: >>> To[cxfbean:healthService] <<< in route:
> Route[[From[jetty:http://0.0.0.0:9089... because of Failed to resolve
> endpoint: cxfbean://healthService due to: No component found with scheme:
> cxfbean
> ---"
> in my ServiceMix startup. Note that this bundle is deployed in the 
> apache-servicemix-4.5.3/deploy directory on a Linux machine.
>  
> This issue can be resolved simply by waiting for ServiceMix to be 
> started for a few minutes and then run touch 
> ./apache-servicemix-4.5.3/deploy/ecs.bundles.health-2.3.0.25-SNAPSHOT.
> jar
>  
> I would like to have the bundle block until the "cxfbean" component is fully started. Again this is a race condition and functionality is fully restored by waiting a couple of minutes and then running touch on the bundle that exposes this camel route.
>  
> Is there a way to say "Really wait on starting this bundle until the cxfbean component is fully started and ready to go"?
>  
>  
> Thank you,
> Zach Calvert




RE: Component Resolution, Camel/SMX Race Condition?

Posted by "Calvert, Zach (Zach)** CTR **" <zc...@motive.com>.
Hi Willem,
Thank you for the help, unfortunately it did not solve the problem.  I have confirmed I have my MANIFEST.MF updated to include:
"
Import-Package: javax.ws.rs,javax.ws.rs.core,javax.xml.bind,javax.xml.bi
 nd.annotation,org.apache.camel.component.cxf.cxfbean,org.apache.commons
 .httpclient,org.apache.commons.httpclient.methods,org.eclipse.jetty.htt
 p,org.springframework.beans.factory.config
Require-Bundle: org.apache.camel.camel-cxf
Tool: Bnd-1.50.0
"

This still does not solve our problem.   I will create a sample bundle as a sub example of the examples project in 4.5.3 and submit a bug against ServiceMix since I think it may be in the framework.



Zach Calvert


-----Original Message-----
From: Willem jiang [mailto:willem.jiang@gmail.com] 
Sent: Wednesday, October 30, 2013 9:45 PM
To: users@camel.apache.org
Subject: Re: Component Resolution, Camel/SMX Race Condition?

As the cxfbeanReference wasn’t used by Camel as an OSGi service, so you setting cannot block the loading of the CamelContext.
How about adding the Required-Bundle of camel-cxf in your application bundle?


--
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang
Weibo: 姜宁willem





On Thursday, October 31, 2013 at 5:44 AM, Calvert, Zach (Zach)** CTR ** wrote:

> This is somewhat of a cross post between here and the ApacheServiceMix mailing list, but I'm thinking I should have fired this email to camel in the first place. I apologize for the cross post in advance.
>  
> I'm making use of the cxfbean component in Apache ServiceMix 4.5.3. I have reviewed the source and OSGI services being exposed here to try to get around the race condition I am experiencing, but while the service is up and running, ServiceMix/Camel does not yet recognize the component and I'm not sure who to direct this question/problem to.
>  
> Breakdown:
> I have a bundle which has the following route:
>  
> <camel:route>
> <camel:from uri="jetty:
> http://0.0.0.0:9089/health/?matchOnUriPrefix=true" /> <camel:to 
> uri="cxfbean:healthService" /> </camel:route>
>  
> The health service implementation is a standard javax.ws.rs annotated 
> class. The cxfbean component is exposed in the camel-cxf feature under the camel-cxf-2.10.7 bundle (I have confirmed). To try to enforce that the cxfbean service really, really is running, I have added <osgi:reference id="cxfbeanReference" cardinality="1..1"
> interface="org.apache.camel.spi.ComponentResolver"
> filter="(component=cxfbean)" />
> to my bundle. This osgi reference is met and fully populated, however 
> I still get
> "----
> Caused by: org.apache.camel.FailedToCreateRouteException: Failed to 
> create route route1 at: >>> To[cxfbean:healthService] <<< in route:
> Route[[From[jetty:http://0.0.0.0:9089... because of Failed to resolve
> endpoint: cxfbean://healthService due to: No component found with scheme:
> cxfbean
> ---"
> in my ServiceMix startup. Note that this bundle is deployed in the 
> apache-servicemix-4.5.3/deploy directory on a Linux machine.
>  
> This issue can be resolved simply by waiting for ServiceMix to be 
> started for a few minutes and then run touch 
> ./apache-servicemix-4.5.3/deploy/ecs.bundles.health-2.3.0.25-SNAPSHOT.
> jar
>  
> I would like to have the bundle block until the "cxfbean" component is fully started. Again this is a race condition and functionality is fully restored by waiting a couple of minutes and then running touch on the bundle that exposes this camel route.
>  
> Is there a way to say "Really wait on starting this bundle until the cxfbean component is fully started and ready to go"?
>  
>  
> Thank you,
> Zach Calvert




Re: Component Resolution, Camel/SMX Race Condition?

Posted by Willem jiang <wi...@gmail.com>.
As the cxfbeanReference wasn’t used by Camel as an OSGi service, so you setting cannot block the loading of the CamelContext.
How about adding the Required-Bundle of camel-cxf in your application bundle?


--  
Willem Jiang

Red Hat, Inc.
Web: http://www.redhat.com
Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English)
          http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese)
Twitter: willemjiang  
Weibo: 姜宁willem





On Thursday, October 31, 2013 at 5:44 AM, Calvert, Zach (Zach)** CTR ** wrote:

> This is somewhat of a cross post between here and the ApacheServiceMix mailing list, but I'm thinking I should have fired this email to camel in the first place. I apologize for the cross post in advance.
>  
> I'm making use of the cxfbean component in Apache ServiceMix 4.5.3. I have reviewed the source and OSGI services being exposed here to try to get around the race condition I am experiencing, but while the service is up and running, ServiceMix/Camel does not yet recognize the component and I'm not sure who to direct this question/problem to.
>  
> Breakdown:
> I have a bundle which has the following route:
>  
> <camel:route>
> <camel:from uri="jetty:
> http://0.0.0.0:9089/health/?matchOnUriPrefix=true" />
> <camel:to uri="cxfbean:healthService" />
> </camel:route>
>  
> The health service implementation is a standard javax.ws.rs annotated class. The cxfbean component is exposed in the camel-cxf feature under the camel-cxf-2.10.7 bundle (I have confirmed). To try to enforce that the cxfbean service really, really is running, I have added
> <osgi:reference id="cxfbeanReference" cardinality="1..1"
> interface="org.apache.camel.spi.ComponentResolver"
> filter="(component=cxfbean)" />
> to my bundle. This osgi reference is met and fully populated, however I still get
> "----
> Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create
> route route1 at: >>> To[cxfbean:healthService] <<< in route:
> Route[[From[jetty:http://0.0.0.0:9089... because of Failed to resolve
> endpoint: cxfbean://healthService due to: No component found with scheme:
> cxfbean
> ---"
> in my ServiceMix startup. Note that this bundle is deployed in the
> apache-servicemix-4.5.3/deploy directory on a Linux machine.
>  
> This issue can be resolved simply by waiting for ServiceMix to be started
> for a few minutes and then run
> touch ./apache-servicemix-4.5.3/deploy/ecs.bundles.health-2.3.0.25-SNAPSHOT.jar
>  
> I would like to have the bundle block until the "cxfbean" component is fully started. Again this is a race condition and functionality is fully restored by waiting a couple of minutes and then running touch on the bundle that exposes this camel route.
>  
> Is there a way to say "Really wait on starting this bundle until the cxfbean component is fully started and ready to go"?
>  
>  
> Thank you,
> Zach Calvert