camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claus Ibsen <claus.ib...@gmail.com>
Subject Re: Blueprint route not shutdown when using OSGi service processor
Date Mon, 20 Jan 2014 12:35:54 GMT
Hi

Yeah that is a little bug, fell free to log a JIRA ticket
http://camel.apache.org/support

The route description uses .toString which we may want to simplify to
avoid these cascaded toString on potential proxied osgi services which
either waits forever or fails or whatnot.


On Fri, Jan 17, 2014 at 8:40 AM, Dominik Amon
<dominik.amon@iso-gruppe.com> wrote:
> Hi all,
>
> I am currently working on a Camel project inside Fuse ESB but also saw this
> problem inside the latest Servicemix release.
>
> When using an OSGi service as processor inside a route and I try to
> uninstall the project the route that uses the processor gets not shut down
> because it calls the toString() method of the OSGi service which is already
> uninstalled.
>
> I don't know if it is a real bug but wanted to share my experience. A simple
> workaround can also be seen at the end of the post.
>
> The setup:
>
> Following bundles are involved:
> - Service-API-Bundle
> - Service-Implementation-Bundle
> - Camel-Route-Bundle
>
> The route looks like:
> ---------------------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
>            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:camel="http://camel.apache.org/schema/blueprint"
>            xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
> xmlns:cxf="http://cxf.apache.org/blueprint/core"
>            xsi:schemaLocation="
>        http://www.osgi.org/xmlns/blueprint/v1.0.0
> http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
>        http://camel.apache.org/schema/blueprint
> http://camel.apache.org/schema/blueprint/camel-blueprint.xsd
>        http://cxf.apache.org/blueprint/jaxrs
> http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
>        http://cxf.apache.org/blueprint/core
> http://cxf.apache.org/schemas/blueprint/core.xsd">
>
>
>     <reference id="osgiService" interface="sample.Service"/>
>
>     <camelContext id="camelContext"
>                   xmlns="http://camel.apache.org/schema/blueprint">
>
>       <route id="route">
>         <from uri="direct-vm:start"/>
>
>
>         <process ref="bean:osgiService"/>
>
>     </camelContext>
>
> </blueprint>
> ---------------------------------------------
>
> Now if uninstalling all bundles or updating the "Service-Bundles" it happens
> that the route does not shut down as it tries invoke the toString() method
> of the OSGi service.
>
> The invocation of the toString() method originates from
> org.apache.camel.impl.RouteService.doStop() where the LifecycleStrategys
> onRoutesremove() method is invoked which in turn calls the
> getManagedObjectForRoute() method of the DefaultManagementObjectStrategy
> class. Now this class creates a new ManagedRoute which invokes the
> toString() method of the route.
>
> The following stack trace shows this:
>
> ---------------------------------------------
>
> org.osgi.service.blueprint.container.ServiceUnavailableException: Timeout
> expired when waiting for mandatory OSGi service reference:
> (&(type=rest)(objectClass=com.dertouristik.dto.engis.commons.errorrenderer.ErrorRenderer))
>         at
> org.apache.aries.blueprint.container.ReferenceRecipe.getService(ReferenceRecipe.java:226)
>         at
> org.apache.aries.blueprint.container.ReferenceRecipe.access$000(ReferenceRecipe.java:54)
>         at
> org.apache.aries.blueprint.container.ReferenceRecipe$ServiceDispatcher.call(ReferenceRecipe.java:291)
>         at Proxy5b7cc1fb_451d_4876_8118_a426c5be850a.toString(Unknown Source)
>         at java.lang.String.valueOf(String.java:2854)[:1.7.0_09]
>         at java.lang.StringBuilder.append(StringBuilder.java:128)[:1.7.0_09]
>         at org.apache.camel.processor.WrapProcessor.toString(WrapProcessor.java:39)
>         at java.lang.String.valueOf(String.java:2854)[:1.7.0_09]
>         at java.lang.StringBuilder.append(StringBuilder.java:128)[:1.7.0_09]
>         at
> org.apache.camel.processor.interceptor.DefaultChannel.toString(DefaultChannel.java:341)
>         at java.lang.String.valueOf(String.java:2854)[:1.7.0_09]
>         at java.lang.StringBuilder.append(StringBuilder.java:128)[:1.7.0_09]
>
> [Skipped lines not of interrest]
>
>         at java.lang.String.valueOf(String.java:2854)[:1.7.0_09]
>         at java.lang.StringBuilder.append(StringBuilder.java:128)[:1.7.0_09]
>         at
> org.apache.camel.processor.DelegateAsyncProcessor.toString(DelegateAsyncProcessor.java:62)
>         at
> org.apache.camel.processor.RouteInflightRepositoryProcessor.toString(RouteInflightRepositoryProcessor.java:62)
>         at java.lang.String.valueOf(String.java:2854)[:1.7.0_09]
>         at java.lang.StringBuilder.append(StringBuilder.java:128)[:1.7.0_09]
>         at
> org.apache.camel.management.InstrumentationProcessor.toString(InstrumentationProcessor.java:50)
>         at java.lang.String.valueOf(String.java:2854)[:1.7.0_09]
>         at java.lang.StringBuilder.append(StringBuilder.java:128)[:1.7.0_09]
>         at
> org.apache.camel.impl.EventDrivenConsumerRoute.toString(EventDrivenConsumerRoute.java:51)
>         at
> org.apache.camel.management.mbean.ManagedRoute.<init>(ManagedRoute.java:52)
>         at
> org.apache.camel.management.mbean.ManagedSuspendableRoute.<init>(ManagedSuspendableRoute.java:30)
>         at
> org.apache.camel.management.DefaultManagementObjectStrategy.getManagedObjectForRoute(DefaultManagementObjectStrategy.java:116)
>         at
> org.apache.camel.management.DefaultManagementLifecycleStrategy.onRoutesRemove(DefaultManagementLifecycleStrategy.java:537)
>         at org.apache.camel.impl.RouteService.doStop(RouteService.java:192)
>         at
> org.apache.camel.support.ChildServiceSupport.stop(ChildServiceSupport.java:74)
>         at
> org.apache.camel.support.ChildServiceSupport.stop(ChildServiceSupport.java:98)
>         at org.apache.camel.util.ServiceHelper.stopService(ServiceHelper.java:112)
>         at
> org.apache.camel.util.ServiceHelper.stopAndShutdownService(ServiceHelper.java:158)
>         at
> org.apache.camel.impl.DefaultCamelContext.shutdownServices(DefaultCamelContext.java:1740)
>         at
> org.apache.camel.impl.DefaultCamelContext.shutdownServices(DefaultCamelContext.java:1765)
>         at
> org.apache.camel.impl.DefaultCamelContext.shutdownServices(DefaultCamelContext.java:1753)
>         at
> org.apache.camel.impl.DefaultCamelContext.doStop(DefaultCamelContext.java:1616)
>         at org.apache.camel.support.ServiceSupport.stop(ServiceSupport.java:91)
>         at
> org.apache.camel.blueprint.BlueprintCamelContext.destroy(BlueprintCamelContext.java:109)
>
> ---------------------------------------------
>
> The problem now is in the org.apache.camel.processor.WrapProcessor which
> invokes the toString() method of the already uninstalled OSGi service.
>
> A really simple workaround is to replace
>
> <process ref="osgiService"/>
>
> with
>
> <to uri="bean:osgiService"/>
>
>
> Kind regards
> Dominik
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Blueprint-route-not-shutdown-when-using-OSGi-service-processor-tp5746114.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Make your Camel applications look hawt, try: http://hawt.io

Mime
View raw message