admin管理员组

文章数量:1122832

so first I'm new to Talend ESB, Camel and Karaf and I'm facing an issue when I try to get a datasource (that has been created on a Karaf instance).

Here is the DataSources GBMREFPPR, is the one I'm trying to use.

I'm trying to get the connection using a java Bean like this :

try {
    DataSource source = (DataSource) camelcontext.getRegistry().lookupByName("GBMREFPPR");
    con = source.getConnection();
    } catch (Exception e) {
        System.out.println(e);
    }

And when the route starts I get a java NullPointerException.

So is what I am trying to do is possible, and if so what am I doing wrong ?

Thanks.

本文标签: javaTalend ESBKarafGet datasource from CamelContextregistryStack Overflow