本文介绍了无法在 Websphere 8.5 中部署包含通过 aries 蓝图定义的骆驼路由的 osgi 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I created an .eba file (enterprise bundle archive) that contains one osgi bundle having a apache camel route (Java DSL). The camel context definition is done via a blueprint xml file. When I tried to deploy the .eba file in Websphere Application Server 8.5, I got the following exception:

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.

org.apache.aries.application.modelling.ModellerException: CWSAL0126E: An exception occurred while modelling bundle ib-base_0.0.1.SNAPSHOT: org.apache.aries.application.modelling.ModellerException: org.osgi.service.blueprint.container.ComponentDefinitionException: Unsupported node namespace: http://camel.apache.org/schema/blueprint.

我的蓝图xml文件如下:

My blueprint xml file is as follows:

<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).

I am not too sure why this fails in Websphere. The same .eba file gets successfully deployed in Karaf 3.0.0-SNAPSHOT. (This version of Karaf uses Aries Blueprint version 1.0.0).

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

I guess the same is used or a forked version of the Aries Blueprint 1.0.0 is used in Websphere 8.5.

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

As per the OSGi specs, any blueprint extension handlers for custom namespaces like camel: are retrieved from the OSGi Service Registry under the key (osgi.service.blueprint.namespace). The value element tells the actual namespace 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 不遵守此规范.

I am not too sure why IBM does not honor this spec.

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

Another interesting point to ponder over is the fact that when I tried to create a blueprint .xml file using Websphere Application Developer Tool, it shows only 4 extensions as shown below:

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

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

I ensured that both the camel-core and camel-blueprint bundles are deployed in the internal repository in websphere.

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

I tried to deploy the .eba file as an asset.

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

Not too sure, if I have missed something. I would be glad if someone can point me in the right direction.

最好的问候,

斯拉曼.

推荐答案

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

WebSphere does not support custom namespace extension (other than the one provided by IBM). The main reason being it runs on Aries (Blueprint container) isolated runtime. There are two options

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

Karaf 是骆驼的友好容器.

Karaf is a friendly container for camel.

这篇关于无法在 Websphere 8.5 中部署包含通过 aries 蓝图定义的骆驼路由的 osgi 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-30 00:39