使用蓝图作为ApacheCamelDSL来描述IBMLiberty中的路由



我的目标是让Camel在使用OSGi的IBM Liberty应用程序服务器下运行,并能够在蓝图中描述DSL(域特定语言)路由。我正在取得进展,现在已经安装了一个Liberty环境,并将Camel配置为OSGi捆绑包。当我把Java DSL Camel应用程序作为OSGi捆绑包编写时,一切都如我所愿。

我的最后一步是能够在蓝图中描述我的骆驼路线。为此,我创建了一个新的OSGi捆绑包,并定义了一个blueprint.xml,如下所示:

<?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"
    xmlns:camelBlueprint="http://camel.apache.org/schema/blueprint"
    xsi:schemaLocation="http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint-2.14.1.xsd">
    <camelBlueprint:camelContext>
        <camelBlueprint:route>
            <camelBlueprint:from uri="file:c:/temp/in"/>
            <camelBlueprint:to uri="file:c:/temp/out"/>
        </camelBlueprint:route>
    </camelBlueprint:camelContext>
</blueprint>

当我尝试部署这个OSGi捆绑包时,IBMLibertyOSGi框架未能部署应用程序,并出现以下错误:

[3/2/15 0:42:38:796 CST] 00000035 com.ibm.ws.app.manager.esa.internal.DeploySubsystemAction
A CWWKZ0403E: A management exception was generated when trying to install the application Camel1 into an OSGi framework.  The error text from the OSGi framework is:
Resource does not exist: org.apache.aries.subsystem.core.archive.SubsystemContentRequirement: 
namespace=osgi.identity, attributes={}, directives={filter=(&(osgi.identity=OSGITest1)(type=osgi.bundle)(version>=1.0.0))}, resource=org.apache.aries.subsystem.core.internal.SubsystemResource@7bc2d3bc

不幸的是,这就是我现在所处的困境。我相信IBM Liberty使用Equinox作为OSGi平台,而不是Karaf,但阅读Camel Blueprint文档时,我似乎明白Apache Aries是必需的(Liberty提供并使用),Karaf不是依赖项。

我的歧管。我的测试包的MF是:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: OSGITest1
Bundle-SymbolicName: OSGITest1
Bundle-Version: 1.0.0.qualifier
Bundle-Blueprint: OSGI-INF/blueprint/*.xml
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Export-Package: kolban.osgitest
Import-Package: org.apache.camel;version="2.14.1",
 org.apache.camel.blueprint;version="2.14.1"

如果解析程序看不到捆绑包,或者捆绑包有问题(通常是蓝图),就会出现此消息。如果在删除蓝图时捆绑包解决了问题,那么您需要查看蓝图中可能存在的问题。如果是这种情况,我怀疑您在运行时中没有启用Camel蓝图命名空间处理程序。

我希望这能有所帮助。

问候,格雷厄姆。

最新更新