Vikram,

On Mon, Dec 26, 2016 at 7:04 PM, Vikram Darsi <vda...@advaoptical.com>
wrote:

> Hi Team
>
>
>
> Example-impl feature depends on jayway library which internally depends on
> latest version of fasterxml libraries
>
> Odl-mdsal-apidocs feature also depends on fasterxml libraries of version
> 2.3.2
>
>
>
> When the server is up, Api Doc generator is still in resolved state and
> hence not able to launch APIDOCS page.
>
>
>
> 300 | Resolved |  80 | 1.4.0.Boron                        | MD SAL Rest
> Api Doc Generator
>
>
>
> bundle:restart 300
>
> Error executing command: Error restarting bundles:
>
>                 Unable to start bundle 300: Exception in
> org.opendaylight.netconf.sal.rest.doc.DocProvider.start() of bundle
> org.opendaylight.netconf.sal-rest-docgen.
>

you're not showing the actual exception which happened in start(). You seem
to implying that the WARNING: multiple bundles are exporting package
com.fasterxml.jackson... are the root cause - are you sure? It may well be
- but you're not showing a clear exception stack trace proving it.


> Bundle:tree-show 300 is captured here:  http://pastebin.com/4MHq8FL9
>

WARNING: multiple bundles are exporting package com.fasterxml.jackson.core
- com.fasterxml.jackson.core.jackson-core_2.3.2 [275]
- com.fasterxml.jackson.core.jackson-core_2.8.5 [290]


> Here is or feature xml file definition
>
>
>
> <features name="example-${project.version}" xmlns="http://karaf.apache.
> org/xmlns/features/v1.2.0"
>
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>
>   xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.2.0
> http://karaf.apache.org/xmlns/features/v1.2.0";>
>
>   <repository>mvn:org.opendaylight.controller/features-mdsal/{{VERSION}}/
> xml/features</repository>
>
>   <repository>mvn:org.opendaylight.netconf/features-
> restconf/{{VERSION}}/xml/features</repository>
>
>   <repository>mvn:org.opendaylight.netconf/features-
> netconf-connector/{{VERSION}}/xml/features</repository>
>
>   <feature name='example-api' version='${project.version}'
> description='OpenDaylight :: baseservice :: api'>
>
>     <feature version='${mdsal.model.version}'>odl-mdsal-models</feature>
>
>     <feature version='${odl.mdsal.binding.base.version}'>odl-mdsal-
> binding-base</feature>
>
>     <bundle>mvn:com.adva.ensemble.controller/baseservice-api/{{
> VERSION}}</bundle>
>
>   </feature>
>
>   <feature name='jayway' version='${project.version}' description='Jayway
> Library'>
>
>      <bundle>mvn:com.fasterxml.jackson.core/jackson-databind/
> 2.6.3</bundle>
>
>     <bundle>mvn:com.fasterxml.jackson.core/jackson-core/2.8.5</bundle>
>
>     <bundle>mvn:com.fasterxml.jackson.core/jackson-annotations/2.8.0</bundle>
>
>
>     <bundle>wrap:mvn:org.apache.tapestry/tapestry-json/
> {{VERSION}}</bundle>
>
>     <bundle>mvn:com.jayway.jsonpath/json-path/2.2.0</bundle>
>
>   </feature>
>
>   <feature name='example' version='${project.version}'
> description='OpenDaylight :: baseservice'>
>
>     <feature version='${feature.mdsal.version}'>odl-mdsal-broker</feature>
>
>     <feature version='${project.version}'>example-api</feature>
>
>     <feature version='${feature.netconf.connector.version}'>odl-
> netconf-connector-all</feature>
>
>     <feature version='${project.version}'>jayway</feature>
>
>     <bundle>mvn:com.adva.ensemble.controller/baseservice-impl/{{
> VERSION}}</bundle>
>
>     <bundle>mvn:com.sun.jersey/jersey-core/{{VERSION}}</bundle>
>
>     <bundle>mvn:com.sun.jersey/jersey-client/{{VERSION}}</bundle>
>
>     <bundle>mvn:com.google.code.gson/gson/{{VERSION}}</bundle>
>
>   </feature>
>
>   <feature name='example-rest' version='${project.version}'
> description='OpenDaylight :: baseservice :: REST'>
>
>     <feature version="${project.version}">example</feature>
>
>     <feature version="${feature.restconf.version}">odl-restconf</feature>
>
>   </feature>
>
>   <feature name='example-ui' version='${project.version}'
> description='OpenDaylight :: baseservice :: UI'>
>
>     <feature version="${project.version}">example-rest</feature>
>
>     <feature version="${feature.restconf.version}">odl-mdsal-apidocs</
> feature>
>
>     <feature version="${feature.mdsal.version}">odl-mdsal-xsql</feature>
>
>     <bundle>mvn:org.jolokia/jolokia-osgi/${org.jolokia.
> osgi.version}</bundle>
>
>   </feature>
>
> </features>
>
>
>
>
>
> Any suggestions on how to resolve the issue of “multiple bundles expose
> the same package”?
>


My understanding of OSGi is that in theory it should be possible to load
different version of library such as e.g. Jackson (that, together with the
"dynamic" aspect of -again in theory- being able to load additional bundles
at runtime/unload/reload, is sort of the main point of OSGi).

In practice however, this only really works properly if all involved
bundles MANIFEST.MF have appropriate version="[...,..)" ranges for all
packages on BOTH their respective Export-Package: AND Import-Package:
clauses... in practice, particular for "standard" Java libraries (e.g.
Jackson), or for automatically wrapped ones (wrap:mvn:) that is often not
the case, unfortunately.

To resolve this, you would have to carefully review the MANIFEST.MF of all
involved bundles, and likely fix version/s in some of them... if you really
want to go through that effort - best of luck!

One alternative you have, if you only need to use such 3rd party libraries
from within ONE (!) of your bundles (say your
com.adva.ensemble.controller/baseservice-impl
thing), would be to "embed" 3rd party Java library JARs into your bundle,
in say a lib/ in the bundle JAR (and add them to the classpath in the
MANIFEST; the maven-bundle-plugin can do all this for you). FYI This is
typically considered a "not so great" practice - because you prevent other
bundles from accessing those shared libraries (and if two of your bundles
need to access anything "static" in such an external library then it's
definitely No Go to do this), but it also help to avoid the sort of problem
you have, because you then keep that such libraries "private".

Hope this helps.

Tx,
M.
--
Michael Vorburger <vorbur...@redhat.com> | IRC: vorburger @freenode | ~ =
http://vorburger.ch


>
>
>
>
> Thanks
>
> Vikram
>
> _______________________________________________
> controller-dev mailing list
> controller-dev@lists.opendaylight.org
> https://lists.opendaylight.org/mailman/listinfo/controller-dev
>
>
_______________________________________________
controller-dev mailing list
controller-dev@lists.opendaylight.org
https://lists.opendaylight.org/mailman/listinfo/controller-dev

Reply via email to