"camel-blueprint" 在蓝图声明中找不到名称空间(Felix 中的 Aries)
"camel-blueprint" namespace not found in blueprint declaration (Aries within Felix)
我正在尝试 运行 一个独立的 OSGi 框架到 运行 其中执行骆驼路线的蓝图包。 OSGi框架是Apache Felix,蓝图实现是Apache Aries
以下包被加载到框架的 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>
即使加载了所有包并解决了要求,蓝图容器仍给出以下日志:
[de.hff.yosgi.test1.Test] : Installing test bundle
[org.apache.aries.blueprint.container.BlueprintExtender] : Starting BlueprintContainer destruction process for bundle osgi-test1
[org.apache.aries.blueprint.container.BlueprintExtender] : Not a blueprint bundle or destruction of BlueprintContainer already finished for osgi-test1.
[org.apache.aries.blueprint.container.BlueprintExtender] : Starting BlueprintContainer destruction process for bundle osgi-test1
[org.apache.aries.blueprint.container.BlueprintExtender] : Not a blueprint bundle or destruction of BlueprintContainer already finished for osgi-test1.
[de.hff.yosgi.test1.Test] : Test bundle installed, starting
[org.apache.aries.blueprint.container.BlueprintExtender] : Starting BlueprintContainer destruction process for bundle osgi-test1
[org.apache.aries.blueprint.container.BlueprintExtender] : Not a blueprint bundle or destruction of BlueprintContainer already finished for osgi-test1.
[org.apache.aries.blueprint.container.BlueprintExtender] : Starting BlueprintContainer destruction process for bundle osgi-test1
[org.apache.aries.blueprint.container.BlueprintExtender] : Not a blueprint bundle or destruction of BlueprintContainer already finished for osgi-test1.
[org.apache.aries.blueprint.container.BlueprintExtender] : Scanning bundle osgi-test1 for blueprint application
[org.apache.aries.blueprint.container.BlueprintExtender] : Found blueprint application in bundle osgi-test1 with paths: [bundle://24.0:0/OSGI-INF/blueprint/blueprint.xml]
[org.apache.aries.blueprint.container.BlueprintExtender] : Scheduling creation of blueprint bundle osgi-test1 asynchronously
[org.apache.aries.blueprint.container.BlueprintContainerImpl] : Running blueprint container for bundle osgi-test1 in state Unknown
[org.apache.aries.blueprint.container.BlueprintEventDispatcher] : Sending blueprint container event BlueprintEvent[type=CREATING] for bundle osgi-test1
[de.hff.yosgi.test1.Test] : Test bundle started
[org.apache.aries.blueprint.container.BlueprintContainerImpl] : Running blueprint container for bundle osgi-test1 in state WaitForNamespaceHandlers
[org.apache.aries.blueprint.container.BlueprintContainerImpl] : Bundle osgi-test1 is waiting for namespace handlers [http://camel.apache.org/schema/blueprint]
[org.apache.aries.blueprint.container.BlueprintEventDispatcher] : Sending blueprint container event BlueprintEvent[type=GRACE_PERIOD, dependencies=[(&(objectClass=org.apache.aries.blueprint.NamespaceHandler)(osgi.service.blueprint.namespace=http://camel.apache.org/schema/blueprint))]] for bundle osgi-test1
这里重要的一行是 Waiting for namespace handlers
:测试包找不到 camel-blueprint 命名空间。但是这个命名空间应该在安装的 camel-blueprint 包中定义。
没有蓝图中的camelContext
,一切正常(加载并初始化蓝图服务)。
有没有人遇到过类似的问题?是什么阻止了测试包访问 camel-blueprint 提供的命名空间?
我们通过清理依赖关系解决了这个问题。实际上只需要以下内容:
此外,要在 Aries Blueprint 中成功将 Camel 获取到 运行,在实例化框架时需要一个额外的参数。这允许捆绑包访问 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);
我正在尝试 运行 一个独立的 OSGi 框架到 运行 其中执行骆驼路线的蓝图包。 OSGi框架是Apache Felix,蓝图实现是Apache Aries
以下包被加载到框架的 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>
即使加载了所有包并解决了要求,蓝图容器仍给出以下日志:
[de.hff.yosgi.test1.Test] : Installing test bundle
[org.apache.aries.blueprint.container.BlueprintExtender] : Starting BlueprintContainer destruction process for bundle osgi-test1
[org.apache.aries.blueprint.container.BlueprintExtender] : Not a blueprint bundle or destruction of BlueprintContainer already finished for osgi-test1.
[org.apache.aries.blueprint.container.BlueprintExtender] : Starting BlueprintContainer destruction process for bundle osgi-test1
[org.apache.aries.blueprint.container.BlueprintExtender] : Not a blueprint bundle or destruction of BlueprintContainer already finished for osgi-test1.
[de.hff.yosgi.test1.Test] : Test bundle installed, starting
[org.apache.aries.blueprint.container.BlueprintExtender] : Starting BlueprintContainer destruction process for bundle osgi-test1
[org.apache.aries.blueprint.container.BlueprintExtender] : Not a blueprint bundle or destruction of BlueprintContainer already finished for osgi-test1.
[org.apache.aries.blueprint.container.BlueprintExtender] : Starting BlueprintContainer destruction process for bundle osgi-test1
[org.apache.aries.blueprint.container.BlueprintExtender] : Not a blueprint bundle or destruction of BlueprintContainer already finished for osgi-test1.
[org.apache.aries.blueprint.container.BlueprintExtender] : Scanning bundle osgi-test1 for blueprint application
[org.apache.aries.blueprint.container.BlueprintExtender] : Found blueprint application in bundle osgi-test1 with paths: [bundle://24.0:0/OSGI-INF/blueprint/blueprint.xml]
[org.apache.aries.blueprint.container.BlueprintExtender] : Scheduling creation of blueprint bundle osgi-test1 asynchronously
[org.apache.aries.blueprint.container.BlueprintContainerImpl] : Running blueprint container for bundle osgi-test1 in state Unknown
[org.apache.aries.blueprint.container.BlueprintEventDispatcher] : Sending blueprint container event BlueprintEvent[type=CREATING] for bundle osgi-test1
[de.hff.yosgi.test1.Test] : Test bundle started
[org.apache.aries.blueprint.container.BlueprintContainerImpl] : Running blueprint container for bundle osgi-test1 in state WaitForNamespaceHandlers
[org.apache.aries.blueprint.container.BlueprintContainerImpl] : Bundle osgi-test1 is waiting for namespace handlers [http://camel.apache.org/schema/blueprint]
[org.apache.aries.blueprint.container.BlueprintEventDispatcher] : Sending blueprint container event BlueprintEvent[type=GRACE_PERIOD, dependencies=[(&(objectClass=org.apache.aries.blueprint.NamespaceHandler)(osgi.service.blueprint.namespace=http://camel.apache.org/schema/blueprint))]] for bundle osgi-test1
这里重要的一行是 Waiting for namespace handlers
:测试包找不到 camel-blueprint 命名空间。但是这个命名空间应该在安装的 camel-blueprint 包中定义。
没有蓝图中的camelContext
,一切正常(加载并初始化蓝图服务)。
有没有人遇到过类似的问题?是什么阻止了测试包访问 camel-blueprint 提供的命名空间?
我们通过清理依赖关系解决了这个问题。实际上只需要以下内容:
此外,要在 Aries Blueprint 中成功将 Camel 获取到 运行,在实例化框架时需要一个额外的参数。这允许捆绑包访问 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);