【发布时间】: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 个扩展,如下所示:
- IBM 蓝图扩展
- JPA 蓝图支持
- 蓝图事务支持
- 蓝图资源参考支持
我确保骆驼核心和骆驼蓝图包都部署在 websphere 的内部存储库中。
我尝试将 .eba 文件部署为资产。
不太确定,如果我错过了什么。如果有人能指出我正确的方向,我会很高兴。
最好的问候,
斯拉曼。
【问题讨论】:
标签: dependency-injection websphere apache-camel blueprint aries