Unable to deploy a osgi bundle containing a camel route defined via aries blueprint in Websphere 8.5

吃可爱长大的小学妹 提交于 2019-12-05 06:14:03

问题


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

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>

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

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

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 .

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>

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

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 Blueprint Extension
  2. JPA Blueprint Support
  3. Blueprint Transaction Support
  4. Blueprint Resource Reference support

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

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.

best regards,

Sriraman.


回答1:


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

  • Use camel api instead of blueprint tags
  • Use other container (for e.g. Karaf) which supports custom namespace extension

Karaf is a friendly container for camel.



来源:https://stackoverflow.com/questions/12079286/unable-to-deploy-a-osgi-bundle-containing-a-camel-route-defined-via-aries-bluepr

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!