Hi,
Ensure you already install camel-jdbc feature.
Btw, please don't cross-post same question multiple times, I just saw
your same question in another thread.
Freeman
On 2011-11-14, at 下午8:15, Chaks wrote:
Hello,
Please can someone help me with sample blueprint for Camel JDBC
component,
when I tried the below one, I am getting *NoSuchComponentException*
org.apache.camel.RuntimeCamelException:
org.osgi.service.blueprint.container.NoSuchComponentException: No
component
with id 'jdbc://dataSource' could be found
Please find the blueprint that I have used and advice where I am going
wrong.
*****************************************************************************
<?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"
xsi:schemaLocation="
http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName"
value="org.apache.derby.jdbc.ClientDriver"/>
<property name="url" value="jdbc:derby://localhost:1527/sample" />
<property name="username" value="app" />
<property name="password" value="app" />
</bean>
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route>
<from uri="timer://customerDataTrigger?
delay=2000&period=2000"/>
<setBody>
<constant>select * from APP.CUSTOMER</constant>
</setBody>
<to uri="jdbc:dataSource"/>
<split>
<simple>${body}</simple>
<log message="*** Select all : ${body}"/>
</split>
</route>
</camelContext>
</blueprint>
*****************************************************************************
*Stacktrace*
*****************************************************************************
org.osgi.service.blueprint.container.ComponentDefinitionException:
Unable to
intialize bean camel-41
at
org
.apache
.aries
.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:635)
[7:org.apache.aries.blueprint:0.2.0.incubating]
at
org
.apache
.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:
744)[7:org.apache.aries.blueprint:0.2.0.incubating]
at
org
.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:
64)[7:org.apache.aries.blueprint:0.2.0.incubating]
at
org
.apache
.aries
.blueprint
.container
.BlueprintRepository.createInstances(BlueprintRepository.java:219)
[7:org.apache.aries.blueprint:0.2.0.incubating]
at
org
.apache
.aries
.blueprint
.container
.BlueprintRepository.createInstance(BlueprintRepository.java:198)
[7:org.apache.aries.blueprint:0.2.0.incubating]
at
org
.apache
.aries
.blueprint
.container.BlueprintRepository.create(BlueprintRepository.java:137)
[7:org.apache.aries.blueprint:0.2.0.incubating]
at
org
.apache
.aries
.blueprint
.container
.BlueprintContainerImpl
.getComponentInstance(BlueprintContainerImpl.java:702)
[7:org.apache.aries.blueprint:0.2.0.incubating]
at
org.apache.camel.blueprint.handler.CamelNamespaceHandler
$CamelDependenciesFinder.process(CamelNamespaceHandler.java:499)
[76:org.apache.camel.camel-blueprint:2.6.0]
at
org
.apache
.aries
.blueprint
.container
.BlueprintContainerImpl
.processProcessors(BlueprintContainerImpl.java:479)
[7:org.apache.aries.blueprint:0.2.0.incubating]
at
org
.apache
.aries
.blueprint
.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:
299)[7:org.apache.aries.blueprint:0.2.0.incubating]
at
org
.apache
.aries
.blueprint
.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:
213)[7:org.apache.aries.blueprint:0.2.0.incubating]
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:
441)[:1.6.0_29]
at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)[:
1.6.0_29]
at java.util.concurrent.FutureTask.run(FutureTask.java:138)[:
1.6.0_29]
at
java.util.concurrent.ScheduledThreadPoolExecutor
$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
[:1.6.0_29]
at
java.util.concurrent.ScheduledThreadPoolExecutor
$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)[:
1.6.0_29]
at
java.util.concurrent.ThreadPoolExecutor
$Worker.runTask(ThreadPoolExecutor.java:886)[:1.6.0_29]
at
java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:908)[:1.6.0_29]
at java.lang.Thread.run(Thread.java:662)[:1.6.0_29]
Caused by: org.apache.camel.FailedToCreateRouteException: Failed to
create
route route13 at: >>> To[jdbc:dataSource] <<< in route:
Route[[From[timer://customerDataTrigger?delay=2000&period=20...
because of
Failed to resolve endpoint: jdbc://dataSource due to:
org.osgi.service.blueprint.container.NoSuchComponentException: No
component
with id 'jdbc://dataSource' could be found
at
org
.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:
759)
at
org
.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:
160)
at
org
.apache
.camel.impl.DefaultCamelContext.startRoute(DefaultCamelContext.java:
701)
at
org
.apache
.camel
.impl
.DefaultCamelContext.startRouteDefinitions(DefaultCamelContext.java:
1623)
at
org
.apache
.camel
.impl.DefaultCamelContext.doStartCamel(DefaultCamelContext.java:1412)
at
org
.apache
.camel.impl.DefaultCamelContext.doStart(DefaultCamelContext.java:1321)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:65)
at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:52)
at
org
.apache
.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:1299)
at
org
.apache
.camel
.blueprint
.BlueprintCamelContext.maybeStart(BlueprintCamelContext.java:77)
at
org
.apache
.camel
.blueprint.BlueprintCamelContext.init(BlueprintCamelContext.java:72)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[:
1.6.0_29]
at
sun
.reflect
.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)[:
1.6.0_29]
at
sun
.reflect
.DelegatingMethodAccessorImpl
.invoke(DelegatingMethodAccessorImpl.java:25)[:1.6.0_29]
at java.lang.reflect.Method.invoke(Method.java:597)[:1.6.0_29]
at
org
.apache
.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:
221)[7:org.apache.aries.blueprint:0.2.0.incubating]
at
org
.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:
844)[7:org.apache.aries.blueprint:0.2.0.incubating]
at
org
.apache
.aries
.blueprint.container.BeanRecipe.runBeanProcInit(BeanRecipe.java:633)
[7:org.apache.aries.blueprint:0.2.0.incubating]
... 18 more
Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to
resolve endpoint: jdbc://dataSource due to:
org.osgi.service.blueprint.container.NoSuchComponentException: No
component
with id 'jdbc://dataSource' could be found
at
org
.apache
.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:
449)
at
org
.apache
.camel
.util
.CamelContextHelper.getMandatoryEndpoint(CamelContextHelper.java:47)
at
org
.apache
.camel.model.RouteDefinition.resolveEndpoint(RouteDefinition.java:175)
at
org
.apache
.camel
.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:
110)
at
org
.apache
.camel
.impl.DefaultRouteContext.resolveEndpoint(DefaultRouteContext.java:
116)
at
org
.apache
.camel.model.SendDefinition.resolveEndpoint(SendDefinition.java:64)
at
org
.apache
.camel.model.SendDefinition.createProcessor(SendDefinition.java:58)
at
org
.apache
.camel
.model.ProcessorDefinition.makeProcessor(ProcessorDefinition.java:403)
at
org
.apache
.camel.model.ProcessorDefinition.addRoutes(ProcessorDefinition.java:
174)
at
org
.apache.camel.model.RouteDefinition.addRoutes(RouteDefinition.java:
756)
... 35 more
Caused by: org.apache.camel.RuntimeCamelException:
org.osgi.service.blueprint.container.NoSuchComponentException: No
component
with id 'jdbc://dataSource' could be found
at
org
.apache
.camel.util.ObjectHelper.wrapRuntimeCamelException(ObjectHelper.java:
1139)
at
org
.apache
.camel
.impl
.PropertyPlaceholderDelegateRegistry
.lookup(PropertyPlaceholderDelegateRegistry.java:47)
at
org
.apache
.camel
.impl.DefaultCamelContext.createEndpoint(DefaultCamelContext.java:
1975)
at
org
.apache
.camel.impl.DefaultCamelContext.getEndpoint(DefaultCamelContext.java:
441)
... 44 more
Caused by:
org.osgi.service.blueprint.container.NoSuchComponentException: No
component with id 'jdbc://dataSource' could be found
at
org
.apache
.aries
.blueprint
.container.DependencyGraph.getSortedRecipes(DependencyGraph.java:51)
*****************************************************************************
*****************************************************************************
Thanks,
Chaks.
--
View this message in context:
http://camel.465427.n5.nabble.com/Blueprint-XML-for-Camel-JDBC-component-tp4990596p4990596.html
Sent from the Camel - Users mailing list archive at Nabble.com.
---------------------------------------------
Freeman Fang
FuseSource
Email:ff...@fusesource.com
Web: fusesource.com
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com