问题描述
我创建了一个 .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 规范,自定义命名空间的任何蓝图扩展处理程序,如骆驼:从 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:
- IBM 蓝图扩展
- JPA 蓝图支持
- 蓝图事务支持
- 蓝图资源参考支持
我确保camel-core 和camel-blueprint 包都部署在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
- 使用骆驼 API 代替蓝图标签
- 使用其他支持自定义命名空间扩展的容器(例如 Karaf)
Karaf 是骆驼的友好容器.
Karaf is a friendly container for camel.
这篇关于无法部署包含通过 Websphere 8.5 中的 aries 蓝图定义的骆驼路线的 osgi 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!