Hello everyone:
I have deployed a camel route as an osgi bundle on fuse esb and it works
great :-) , however, my objective is to instantiate this route from another
bundle.
My camel route bundle looks like this:
getContext().setHandleFault(true);
errorHandler(deadLetterChannel("file:data/log/deliveryerrors")
.maximumRedeliveries(2)
.asyncDelayedRedelivery()
.redeliveryDelay(3000)
.useOriginalMessage()
.logStackTrace(true)
.logRetryStackTrace(true)
.retryAttemptedLogLevel(LoggingLevel.ERROR));
from("quartz://fetchUrl?cron=0+0/1+*+*+*+?")
.bean(MyPojo.class,"getHtmlCode")
.wireTap("seda:auditorfeed")
.bean(MyPojo.class,"getUrls")
.wireTap("seda:urlauditor")
.split(body(String.class).tokenize("\n"))
.to("seda:mylinks");
And my aries blueprint file is this one:
<?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"
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/spring/camel-blueprint.xsd">
</blueprint>
The pom file exports the package with my route. Having deployed it, i
developed another simple bundle that would grab this camel route and
instantiate it, this bundle looks like this:
public void init() throws Exception {
CamelContext context = new DefaultCamelContext();
MyRoute myroute = new MyRoute();
System.out.println("trying to start the route");
context.addRoutes(myroute);
//for testing purposes
context.start();
Thread.sleep(100000);
context.stop();
}
And the blueprint for this simple bundle looks like this:
<?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"
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/spring/camel-blueprint.xsd">
<bean
id="myRouteFactory"
class="com.mycompany.RoutesFactory"
init-method="init">
</bean>
</blueprint>
When i try to install this bundle I get the next exception :-S , am i using
the right approach for instantiating a route from another bundle???
21:03:12,418 | ERROR | rint Extender: 3 | BlueprintContainerImpl |
10 - org.apache.aries.blueprint - 0.3.1 | Unable to start blueprint
container for bundle router_factory
org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to
intialize bean myRouteFactory
at
org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:638)[10:org.apache.aries.blueprint:0.3.1]
at
org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:724)[10:org.apache.aries.blueprint:0.3.1]
at
org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:64)[10:org.apache.aries.blueprint:0.3.1]
at
org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:219)[10:org.apache.aries.blueprint:0.3.1]
at
org.apache.aries.blueprint.container.BlueprintRepository.createAll(BlueprintRepository.java:147)[10:org.apache.aries.blueprint:0.3.1]
at
org.apache.aries.blueprint.container.BlueprintContainerImpl.instantiateEagerComponents(BlueprintContainerImpl.java:640)[10:org.apache.aries.blueprint:0.3.1]
at
org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:331)[10:org.apache.aries.blueprint:0.3.1]
at
org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:227)[10:org.apache.aries.blueprint:0.3.1]
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)[:1.6.0_25]
at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:1.6.0_25]
at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:1.6.0_25]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)[:1.6.0_25]
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)[:1.6.0_25]
at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_25]
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_25]
at java.lang.Thread.run(Thread.java:662)[:1.6.0_25]
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to
resolve endpoint: file://data/log/capalerts due to:
org.apache.camel.TypeConverterLoaderException: Failed to load type
converters because of: Cannot find any type converter classes from the
following packages: [org.apache.camel.component.file,
org.apache.camel.component.bean, org.apache.camel.converter]
at
org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:451)
at
org.apache.camel.builder.BuilderSupport.endpoint(BuilderSupport.java:238)
at
org.apache.camel.builder.BuilderSupport.deadLetterChannel(BuilderSupport.java:356)
at com.mycompany.my_main_route.MyRoute.configure(MyRoute.java:42)
at
org.apache.camel.builder.RouteBuilder.checkInitialized(RouteBuilder.java:322)
at
org.apache.camel.builder.RouteBuilder.configureRoutes(RouteBuilder.java:277)
at
org.apache.camel.builder.RouteBuilder.addRoutesToCamelContext(RouteBuilder.java:263)
at
org.apache.camel.impl.DefaultCamelContext.addRoutes(DefaultCamelContext.java:614)
at
com.mycompany.my_routes_factory.RoutesFactory.init(RoutesFactory.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)[:1.6.0_25]
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:1.6.0_25]
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_25]
at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_25]
at
org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:226)[10:org.apache.aries.blueprint:0.3.1]
at
org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:824)[10:org.apache.aries.blueprint:0.3.1]
at
org.apache.aries.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:636)[10:org.apache.aries.blueprint:0.3.1]
... 15 more
Caused by: org.apache.camel.RuntimeCamelException:
org.apache.camel.TypeConverterLoaderException: Failed to load type
converters because of: Cannot find any type converter classes from the
following packages: [org.apache.camel.component.file,
org.apache.camel.component.bean, org.apache.camel.converter]
at
org.apache.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:1139)
at
org.apache.camel.impl.DefaultCamelContext.getTypeConverter(DefaultCamelContext.java:988)
at
org.apache.camel.util.EndpointHelper.setProperties(EndpointHelper.java:225)
at
org.apache.camel.impl.DefaultComponent.setProperties(DefaultComponent.java:200)
at
org.apache.camel.component.file.GenericFileComponent.createEndpoint(GenericFileComponent.java:64)
at
org.apache.camel.component.file.GenericFileComponent.createEndpoint(GenericFileComponent.java:36)
at
org.apache.camel.impl.DefaultComponent.createEndpoint(DefaultComponent.java:75)
at
org.apache.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:433)
... 30 more
Caused by: org.apache.camel.TypeConverterLoaderException: Failed to load
type converters because of: Cannot find any type converter classes from the
following packages: [org.apache.camel.component.file,
org.apache.camel.component.bean, org.apache.camel.converter]
at
org.apache.camel.impl.converter.AnnotationTypeConverterLoader.load(AnnotationTypeConverterLoader.java:79)
at
org.apache.camel.impl.converter.BaseTypeConverterRegistry.loadTypeConverters(BaseTypeConverterRegistry.java:395)
at
org.apache.camel.impl.converter.DefaultTypeConverter.doStart(DefaultTypeConverter.java:41)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:67)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:54)
at
org.apache.camel.util.ServiceHelper.startService(ServiceHelper.java:60)
at
org.apache.camel.impl.DefaultCamelContext.startServices(DefaultCamelContext.java:1620)
at
org.apache.camel.impl.DefaultCamelContext.addService(DefaultCamelContext.java:901)
at
org.apache.camel.impl.DefaultCamelContext.getTypeConverter(DefaultCamelContext.java:986)
... 36 more
--
View this message in context:
http://camel.465427.n5.nabble.com/Instantiating-an-osgi-bundled-camel-route-from-another-bundle-tp4623697p4623697.html
Sent from the Camel - Users mailing list archive at Nabble.com.