Apache camel &引用;骆驼蓝图“;blueprint声明中未找到命名空间(Felix中的Aries)

Apache camel &引用;骆驼蓝图“;blueprint声明中未找到命名空间(Felix中的Aries),apache-camel,osgi,apache-felix,blueprint-osgi,aries,Apache Camel,Osgi,Apache Felix,Blueprint Osgi,Aries,我正在尝试运行一个独立的OSGi框架,在其中运行blueprint捆绑包,以执行驼峰路由。OSGi框架是ApacheFelix,蓝图实现是ApacheAries 以下捆绑包加载到框架的BundleContext: 现在我有了一个测试包,它有一个蓝图定义,其中包含一个camelContext,如下所示: <?xml version="1.0" encoding="UTF-8"?> <blueprint xmlns="http://www.osgi.org/xmlns/bluep

我正在尝试运行一个独立的OSGi框架,在其中运行blueprint捆绑包,以执行驼峰路由。OSGi框架是ApacheFelix,蓝图实现是ApacheAries

以下捆绑包加载到框架的
BundleContext

现在我有了一个测试包,它有一个蓝图定义,其中包含一个
camelContext
,如下所示:

<?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
       http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">

    <camelContext xmlns="http://camel.apache.org/schema/blueprint">
        <route id="testRoute1">
            <from uri="timer:foo?period=5000" />
            <log message="Hello world!" />
        </route>
    </camelContext>

</blueprint>
这里重要的一行是等待名称空间处理程序的
:测试包找不到名称空间。但是这个名称空间应该在安装的camel blueprint包中定义

如果蓝图中没有
camelContext
,一切都可以正常工作(蓝图服务被加载和初始化)


有人有过类似的问题吗?是什么阻止了测试包访问camel blueprint提供的名称空间?

我们通过清理依赖项解决了这个问题。实际上只需要以下内容:

此外,为了成功地让Camel在ariesblueprint内部运行,在实例化框架时需要一个额外的参数。这允许捆绑包访问
sun.*

Iterator<FrameworkFactory> iterator = 
        ServiceLoader.load(FrameworkFactory.class).iterator();
FrameworkFactory factory = iterator.next();

Map<> configuration = new HashMap<String, String>();
configuration.put("org.osgi.framework.bootdelegation", "sun.*");
this.framework = factory.newFramework(configuration);
迭代器迭代器=
load(FrameworkFactory.class).iterator();
FrameworkFactory=iterator.next();
映射配置=新的HashMap();
configuration.put(“org.osgi.framework.bootdegration”,“sun.*);
this.framework=factory.newFramework(配置);

您需要将camel依赖项安装到OSGi框架中。例如驼峰核心、驼峰蓝图等@ClausIbsen参见
camel-blueprint-2.18.0.jar
camel-core-2.18.0.jar
;-)问题是一些已安装的JAR产生了冲突,我将很快对此给出一个答案。
Iterator<FrameworkFactory> iterator = 
        ServiceLoader.load(FrameworkFactory.class).iterator();
FrameworkFactory factory = iterator.next();

Map<> configuration = new HashMap<String, String>();
configuration.put("org.osgi.framework.bootdelegation", "sun.*");
this.framework = factory.newFramework(configuration);