2008/9/24 qrtt1 <[EMAIL PROTECTED]> > > Hello, I use pax-wrap-jar to wrap xercesImpl but something wrong with > unresolved sun.io. > How do I fix this problem ? >
Ok, well it looks like your wrapped bundle uses the sun.io package and BND has therefore added an import for it. To satisfy this import another bundle needs to export that package. The obvious candidate to export the sun.io package would be the Felix system bundle, as it can access JRE packages like sun.io To change the packages exported by the system bundle you need to update the "org.osgi.framework.system.packages" config property in the configuration file, see more about configuring Felix here: http://felix.apache.org/site/apache-felix-usage-documentation.html or the embedding page (if you're embedding Felix in another app) http://felix.apache.org/site/launching-and-embedding-apache-felix.html There are alternatives to doing this: 1) you could remove the import by editing the osgi.bnd file in the maven project to use the following instruction: Import-Package: !sun.io.*, * and use the "org.osgi.framework.bootdelegation" property to delegate any requests for sun.io to the bootclasspath: # set in Felix config.properties / via launcher org.osgi.framework.bootdelegation=sun.io.* this effectively bypasses the normal import/export wiring 2) if you know that you don't actually need the sun.io package at runtime (unlikely in this case - but this sometimes happens with libraries that also include Ant tasks, etc.) then you can mark that import as optional: Import-Package: sun.io.*;resolution:=optional, * this means your bundle will install and resolve even when the sun.io package is missing - but you would get a CNF exception if your bundle actually tried to load from sun.io another approach that's similar to optional imports is to use DynamicImport-Package: sun.io.* this also lets your bundle install even when sun.io is missing but the difference here is that the framework will continue to check to see if another bundle exports sun.io on each load request until it is satisfied (ie. you'd see CNF exceptions as with optional imports, but could then load another bundle to fix this) - however once the import is satisfied the framework will continue to use the same exporting bundle until a refresh HTH Error like this: > > ERROR: Error starting > file:/C:/openlabWorkspace/insight/runner/bundles/xerces.xe > rcesImpl_2.8.1.jar (org.osgi.framework.BundleException: Unresolved > constraint in > bundle 24: package; (package=sun.io)) > org.osgi.framework.BundleException: Unresolved constraint in bundle 24: > package; > (package=sun.io) > at org.apache.felix.framework.Felix._resolveBundle(Felix.java:1725) > at org.apache.felix.framework.Felix._startBundle(Felix.java:1588) > at org.apache.felix.framework.Felix.startBundle(Felix.java:1541) > at > org.apache.felix.framework.Felix.setFrameworkStartLevel(Felix.java:1135) > at > org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:267) > at java.lang.Thread.run(Thread.java:619) > > > Thanks for any suggestions. > -- > View this message in context: > http://www.nabble.com/Unresolved-sun.io-tp19631558p19631558.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] > > -- Cheers, Stuart

