我创建了一个 .eba 文件(企业捆绑包存档),其中包含一个具有 apache 骆驼路由(Java DSL)的 osgi 捆绑包。 Camel 上下文定义是通过蓝图 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 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 中失败。相同的 .eba 文件已成功部署在 Karaf 3.0.0-SNAPSHOT 中。 (此版本的 Karaf 使用 Aries Blueprint 版本 1.0.0)。
我猜 Websphere 8.5 中也使用了相同的版本,或者使用了 Aries Blueprint 1.0.0 的分叉版本。
根据 OSGi 规范,自定义名称空间(例如camel:)的任何蓝图扩展处理程序都可以从 OSGi 服务注册表中的键 (osgi.service.blueprint.namespace) 下检索。 value 元素告诉实际的命名空间 uri 。
eg:
<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 个扩展名,如下所示:
- IBM 蓝图扩展
- JPA 蓝图支持
- 蓝图交易支持
- 蓝图资源参考支持
我确保camel-core 和camel-blueprint 包都部署在websphere 的内部存储库中。
我尝试将 .eba 文件部署为资产。
不太确定,如果我错过了什么。如果有人能指出我正确的方向,我会很高兴。
此致,
斯里拉曼。