David/Simplemind, I just confirmed that wrap: does mark all imports as resolution:=optional.
It should be noted that for this reason "wrap:" shouldn't be the solution for a "live" system. Instead, use it to identify all of the .jar files your system needs, and then prior to going live, "wrap" all of the non-osgi .jar files your application needs using BND. Peter Kriens has a lot of good information on his website about how to do this, and it also provides a lot of general information about OSGi from a developer's perspective. http://www.aqute.biz/Main/HomePage Please let me know if this answers your questions. David Jencks wrote: > > On Jul 20, 2011, at 10:02 AM, simplemind wrote: > >> I have discovered the problem. Actually it is 2 issues, one is with >> webconsole and the other is with wrap. I am still not sure about >> start-priority, but I think lower number means lower priority. > > The startlevel service starts at priority 1 (or 0, I'm not sure) and loads > all the bundles at that level, starts them, increases the start level by > one, and repeats until done. >> >> The problem with webconsole is that it times out. If you click on load >> a >> feature that takes a while to load the webconsole request times out and >> kills the feature load at whatever point it happens to be. For instance, >> in >> karaf 2.2.2 on my machine I cannot even load the 'war' feature from the >> webconsole because it just takes too long. >> >> The second issue is a really strange one with wrap. Suppose bundle A >> exports a package a.a.a. And suppose B is a wrapped (legacy jar) bundle. >> If I make a feature that has B before A and load the feature and look at >> B >> it shows a.a.a as an optional import in the manifest headers, plus a.a.a >> was >> not imported. But if you load a feature that has A before B, then the >> loaded B has a.a.a in the Imports. >> >> Easy enough to work around these, but they are both big "gochas" that had >> me >> confused in combination for a few wasted hours. If anyone cares to >> explain >> how wrap is determining what are optional imports I would be interested. >> Seems like a bug, because in my case a.a.a was being used and should have >> been imported no matter the load order. Also, why does wrapped bundle >> link >> optional imports if they happen to already be loaded into karaf when the >> bundle is loaded? > > I think wrap marks all imports as optional. This is sort of reasonable if > you have no idea what the jar does and what actually is optional, but > obviously ridiculous if you do know what the jar does. So, its a good > idea to actually look into the contents and figure out what is optional > and what isn't. You can then write a "bundleizing" maven project that > repackages the jar as a bundle or (I think, I never tried it) provide a > lot of info in the wrap url telling bnd what to do. > > Optional package imports work like this: if the optional package happens > to be available when the bundle starts, it's wired in. If it doesn't > happen to be available, it is not wired in even if the package becomes > available later, and if you want to get it wired in you have to refresh > the bundle with the optional import. So you are observing the normal > optional package import behavior. > > You can also use dynamic-import-package which will check for the package > every time you try to use the wire, but this can have performance > implications. > > hope this helps.... > david jencks > >> >> -- >> View this message in context: >> http://karaf.922171.n3.nabble.com/Feature-Dependencies-load-order-tp3184561p3185973.html >> Sent from the Karaf - User mailing list archive at Nabble.com. > ----- Mike Van -- View this message in context: http://karaf.922171.n3.nabble.com/Feature-Dependencies-load-order-tp3184561p3186648.html Sent from the Karaf - User mailing list archive at Nabble.com.
