【问题标题】:Unable to deploy a osgi bundle containing a camel route defined via aries blueprint in Websphere 8.5无法在 Websphere 8.5 中部署包含通过 aries 蓝图定义的骆驼路由的 osgi 包
【发布时间】:2012-08-22 18:32:52
【问题描述】:

我创建了一个 .eba 文件(企业包存档),其中包含一个具有 apache 骆驼路由(Java DSL)的 osgi 包。骆驼上下文定义是通过一个蓝图 xml 文件完成的。当我尝试在 Websphere Application Server 8.5 中部署 .eba 文件时,出现以下异常:

org.apache.aries.application.modelling.ModellerException: CWSAL0126E: 建模捆绑时发生异常 ib-base_0.0.1.SNAPSHOT: org.apache.aries.application.modelling.ModellerException: org.osgi.service.blueprint .container.ComponentDefinitionException:不支持的节点命名空间:http://camel.apache.org/schema/blueprint

我的蓝图xml文件如下:

<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:camel="http://camel.apache.org/schema/blueprint"
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">

<camel:camelContext id="cbrContext" trace="false">
    <camel:packageScan>
        <camel:package>a.b.c.d</camel:package>
    </camel:packageScan>
</camel:camelContext>
</blueprint>

我不太清楚为什么这在 Websphere 中会失败。在 Karaf 3.0.0-SNAPSHOT 中成功部署了相同的 .eba 文件。 (此版本的 Karaf 使用 Aries Blueprint 版本 1.0.0)。

我猜在 Websphere 8.5 中使用了相同的版本或 Aries Blueprint 1.0.0 的分叉版本。

根据 OSGi 规范,自定义命名空间(如 camel:)的任何蓝图扩展处理程序都从 OSGi 服务注册表中的键 (osgi.service.blueprint.namespace) 中检索。 value 元素告诉实际的命名空间 uri 。

例如:

<service interface="org.apache.aries.blueprint.NamespaceHandler">
    <service-properties>
        <entry key="osgi.service.blueprint.namespace" value="http://camel.apache.org/schema/blueprint"/>
    <entry key="osgi.service.blueprint.namespace" value="http://camel.apache.org/schema/blueprint/cxf"/>
    </service-properties>
    <bean class="org.apache.camel.blueprint.handler.CamelNamespaceHandler">
    </bean>
</service>

我不太清楚为什么 IBM 不遵守此规范。

另一个值得思考的有趣点是,当我尝试使用 Websphere Application Developer Tool 创建一个蓝图 .xml 文件时,它只显示了 4 个扩展,如下所示:

  1. IBM 蓝图扩展
  2. JPA 蓝图支持
  3. 蓝图事务支持
  4. 蓝图资源参考支持

我确保骆驼核心和骆驼蓝图包都部署在 websphere 的内部存储库中。

我尝试将 .eba 文件部署为资产。

不太确定,如果我错过了什么。如果有人能指出我正确的方向,我会很高兴。

最好的问候,

斯拉曼。

【问题讨论】:

    标签: dependency-injection websphere apache-camel blueprint aries


    【解决方案1】:

    WebSphere 不支持自定义名称空间扩展(IBM 提供的除外)。主要原因是它在 Aries(蓝图容器)隔离运行时上运行。有两种选择

    • 使用骆驼api代替蓝图标签
    • 使用其他支持自定义命名空间扩展的容器(例如 Karaf)

    Karaf 是骆驼的友好容器。

    【讨论】:

      猜你喜欢
      • 2020-01-11
      • 1970-01-01
      • 2017-08-05
      • 1970-01-01
      • 1970-01-01
      • 2013-03-09
      • 1970-01-01
      • 1970-01-01
      • 2023-04-02
      相关资源
      最近更新 更多