karaf-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Christian Schneider <ch...@die-schneider.net>
Subject Re: Camel cannot find a Karaf registered datasource
Date Mon, 08 Aug 2016 15:52:49 GMT
I think the problem is that camel can not find the DataSource in its 
registry.
If you use blueprint then camel by default bases the registry on 
blueprint beans.
So for jdbc:unbdev it searches for a bean with id="unbdev" and type 
DataSource.
You can provide this bean by defining this reference in blueprint:

<reference id="unbdev" interface="javax.sql.DataSource"/>

This will import the first OSGi service of type DataSource it finds and 
provide it as a named bean in blueprint. If you have more than one
DataSource you will need to add a filter.

See also:
https://docs.google.com/document/d/1oX4RnLWad4b2phlIRluKIZAw9jEakl3Gy61oE1A-AAw/edit

Christian

On 08.08.2016 17:31, LiamO wrote:
> Hi, I had a lot of fun and games registering a firebird datasource in Karaf.
> Thanks to PAX-JDBC and Christian Scheider's tutorial I was able to manage
> this and have the datasource
>
> karaf@root()> jdbc:ds-list Name | Product | Version | URL | Status
> ------------------------------------------------------------------------------------------------------------------------
> ----------
> unbdev | Firebird 2.58LI | LI-V2.5.3.26778 |
> jdbc:firebirdsql:java://lo-******-dev-01/opt/unb/db/*********12-05-2016.fdb
> | OK
>
> I can interrogate the db using the Karaf jdbc commands. Unfortunately when I
> try to run a Camel instance containing the following route
>
> public void configure() throws Exception {
>    from("direct:makeFile")
>    .to("jdbc:unbdev").split(body()).process(new ResultToReport())
>    .to("file:/testx/?charset=utf-8") .to("direct:makeFileComplete");
> }
>
> I get an Activator start error with the cause
>
> Caused by: org.apache.camel.FailedToCreateRouteException: Failed to create
> route route71 at: >>> To[jdbc:unbdev] <<< in route:
> Route(route71)[[From[direct:makeFile]] -> [To[jdbc:unbdev], ... because of
> Failed to resolve endpoint: jdbc://unbdev due to: No bean could be found in
> the registry for: unbdev of type: javax.sql.DataSource
>
> Naturally the route works fine in a unit test outside of Karaf using a
> simple registry. I'm sorry as it looks like something so simple but I am
> just left scratching my head. Oh and I am running on Karaf 4.0.5 and Camel
> 2.17.2. Thanks in advance.
> Regards, Liam
>
>
>
>
> --
> View this message in context: http://karaf.922171.n3.nabble.com/Camel-cannot-find-a-Karaf-registered-datasource-tp4047459.html
> Sent from the Karaf - User mailing list archive at Nabble.com.


-- 
Christian Schneider
http://www.liquid-reality.de

Open Source Architect
http://www.talend.com


Mime
View raw message