Start order cannot be the cause of such problems, because resolution does not depend on starting (rather the other way around).
What does cause problems is *install* order, especially if you are installing a series of bundles and starting each one as it is installed. This forces a resolution after each install, and therefore the ordering becomes very sensitive. In OSGi you should always FIRST install ALL of the bundles you want to install, and THEN start them in any order. When you do this, OSGi nearly always finds a correct solution, with only one enabled export per package... assuming a solution actually exists. I don't know what the PAX tool does when you give it that list of bundles in commands.txt, but if it does a series "install, start, install, start" operations then you need to find a better tool. Neil On Mon, Nov 12, 2012 at 8:10 AM, Pierre De Rop <[email protected]>wrote: > Hi Bokie, > > I reproduced the problem with config-admin 1.6.0. Are you also using it ? > > Anyway, Felix found the root cause: it's because of a duplicate export of > the CM api (org.osgi.service.cm package): > > 1) config-admin 1.6.0 exports org.osgi.service.cm with version=1.5 > (because > it implements the latest enterprise osgi compendium). > > 2) and dependencymanager core imports the org.osgi.service.cm with the > version range "[1.3,2)", because DM has been compiled with compendium 4.2.0 > > Now, depending on the start order, we may have the following situation: > > - if config-admin is resolved/started *before* dependencymanager, then we > don't have the problem: dependencymanager is wired to the correct > org.osgi.service.cm package with version 1.5 (exported by config-admin > 1.6.0). > > - but if config-admin is resolved/started *after* dependencymanager, then > we have the problem: that is: dependencymanager bundle is wired to the > wrong 1.4 cm package, exported by the org.osgi.compendium-4.3.1 bundle). > > For example, using the following pax-runner command file, I reproduce the > problem: > > pax-run.sh commands.txt > > and here is the commands.txt file: > > file:bundles/org.apache.felix.gogo.command-0.12.0.jar@1 > file:bundles/org.apache.felix.gogo.runtime-0.10.0.jar@1 > file:bundles/org.apache.felix.gogo.shell-0.10.0.jar@5 > file:bundles/org.apache.felix.webconsole.jar@5 > file:bundles/org.apache.felix.gogo.runtime-0.10.0.jar@5 > file:bundles/biz.aQute.bndlib-1.43.0.jar@5 > file:bundles/org.apache.felix.dependencymanager-3.0.0.jar@5 > # start config admin *after* dependencymanager > file:bundles/org.apache.felix.configadmin-1.6.0.jar@5 > file:bundles/org.apache.felix.metatype-1.0.7-SNAPSHOT.jar@5 > file:bundles/org.apache.felix.dependencymanager.shell-3.0.0.jar@5 > file:bundles/test.dm-1.0.jar@5 > file:bundles/org.apache.felix.http.jetty.jar@5 > file:bundles/org.apache.felix.shell-1.4.3.jar@5 > file:bundles/org.apache.felix.dependencymanager.runtime-3.0.0.jar@5 > file:bundles/org.osgi.compendium-4.3.1.jar@5 > file:bundles/org.apache.felix.bundlerepository-1.6.6.jar@5 > > now, if we manage to start config-admin before dependencymanager, then it > works: > > file:bundles/org.apache.felix.gogo.command-0.12.0.jar@1 > file:bundles/org.apache.felix.gogo.runtime-0.10.0.jar@1 > file:bundles/org.apache.felix.gogo.shell-0.10.0.jar@5 > file:bundles/org.apache.felix.webconsole.jar@5 > file:bundles/org.apache.felix.gogo.runtime-0.10.0.jar@5 > file:bundles/biz.aQute.bndlib-1.43.0.jar@5 > # start config admin *before* dependencymanager > file:bundles/org.apache.felix.configadmin-1.6.0.jar@5 > file:bundles/org.apache.felix.dependencymanager-3.0.0.jar@5 > file:bundles/org.apache.felix.metatype-1.0.7-SNAPSHOT.jar@5 > file:bundles/org.apache.felix.dependencymanager.shell-3.0.0.jar@5 > file:bundles/test.dm-1.0.jar@5 > file:bundles/org.apache.felix.http.jetty.jar@5 > file:bundles/org.apache.felix.shell-1.4.3.jar@5 > file:bundles/org.apache.felix.dependencymanager.runtime-3.0.0.jar@5 > file:bundles/org.osgi.compendium-4.3.1.jar@5 > file:bundles/org.apache.felix.bundlerepository-1.6.6.jar@5 > > > so, shortly speaking: if you really need to use the > org.osgi.compendium-4.3.1 bundle, and if you are also using config-admin > 1.6.0, then you have to manage to start the config-admin 1.6.0 bundle > before dependencymanager. > > now ... > > there is something which is troubling me: > > as far as I know, the framework should wire dependencymanager to the " > org.osgi.service.cm" package with the highest exported version (that is: > the one exported by config-admin 1.6.0). > > So, I'm not sure why we should really start config-admin first. > > The other problem that troubles me is we don't have any problems at all > with equinox (that is: using pax-run.sh --p=equinox commands.txt). > > So, I wonder if there is (or not) a problem to be investigated in the > framework ? > > Felix, what do you think ? > > kind regards; > /Pierre > > > On Mon, Nov 12, 2012 at 7:24 AM, Felix Meschberger <[email protected] > >wrote: > > > Hi, > > > > Am 11.11.2012 um 14:26 schrieb bokie: > > > > > Hi, > > > > > > When I deploy the osgi.cmpn-4.3.1.jar file as apposed to > > osgi.cmpn-4.2.0.jar > > > > Is there a reason for deploying this ? > > > > > > > file I get the following exception: > > > org.apache.felix.dm.impl.dependencies.ConfigurationDependencyImpl > cannot > > be > > > cast to org.osgi.service.cm.ManagedService > > > > It looks very much there is a duplicate export of the Configuration Admin > > API at two different versions, one from the osgi.cmpn bundle and one from > > the Configuration Admin bundle. These do not seem to be the same (you > might > > consider updating the Configuration Admin bundle) and thus the > > Configuration Admin service wires to its own export (because it looks to > be > > an older version not implementing the newer version exported by the 4.3.1 > > osgi.cmpn bundle). The Dependency Manager bundle wires to the newer API > and > > thus these two are not compatible. > > > > Still this exception looks strange. > > > > > > > > Can someone provide some input on this? > > > > See above. > > > > > Should I even be trying to deploy the 4.3.1 version of the cmpn with > > felix > > > 4.0.3? > > > > Good question. The Felix implementations of the OSGi specs usually > include > > the respective API and thus the deployment of the osgi.cmpn bundle is not > > required and (as in your case) may even cause trouble. > > > > Regards > > Felix > > > > > > > > Thanks, > > > Bokie > > > > > > > > > > > > > > > -- > > > View this message in context: > > > http://apache-felix.18485.n6.nabble.com/DependencyManager-osgi-cmpn-4-3-1-tp5000342.html > > > Sent from the Apache Felix - Users mailing list archive at Nabble.com. > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [email protected] > > > For additional commands, e-mail: [email protected] > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > >

