This is not a bug. It is just something that doesn't work on android but we do handle it correctly. The only result should be that you see a warning in the log but it shouldn't have any negative impact.
regards, Karl On Fri, Apr 30, 2010 at 7:49 PM, Jackson, Bruce <bru...@qualcomm.com> wrote: > I've now followed the Felix code through to the source of this problem which > appears to be in ModuleImpl: > > static > { > ClassLoader cl = null; > try > { > Constructor ctor = m_secureAction.getDeclaredConstructor( > SecureClassLoader.class, new Class[] { ClassLoader.class }); > m_secureAction.setAccesssible(ctor); > cl = (ClassLoader) m_secureAction.invoke(ctor, new Object[] { null > }); > } > catch (Throwable ex) > { > // On Android we get an exception if we set the parent class loader > // to null, so we will work around that case by setting the parent > // class loader to the system class loader in getClassLoader() > below. > cl = null; > System.err.println("Problem creating boot delegation class loader: > " + ex); > ex.printStackTrace(); > } > m_defBootClassLoader = cl; > } > > This seems to be trying to create a new instance of SecureClassLoader, which > is failing because SecureClassLoader doesn’t have any public constructor. > This is therefore throwing an InvocationTargetException and is, I believe > responsible for the problem I’m seeing. Has this been reported as a bug, does > anyone know? > > Thanks > > Bruce > > On 30/04/2010 17:14, "Bruce Jackson" <bru...@qualcomm.com> wrote: > >> Yes, I'm aware of that. What I meant was that I've seen that it works on >> Felix releases with the framework version set to 1.2, but I can't get this >> working with the current release. >> >> >> On 30/04/2010 17:03, "Richard S. Hall" <he...@ungoverned.org> wrote: >> >>> On 4/30/10 9:50, Jackson, Bruce wrote: >>>> I've added the lines: >>>> >>>> // calculate the export packages list from the environment >>>> >>>> config.put("org.osgi.framework.system.packages", >>>> ANDROID_FRAMEWORK_PACKAGES); >>>> config.put("org.osgi.framework.bundle.parent", "app"); >>>> config.put("felix.log.level", "1"); >>>> >>>> and tried this with app, framework, boot and also ext, but I get the same >>>> result I'm afraid. I've certainly seen out on the web that people have done >>>> with with almost identical code on earlier version of Felix (I can't be >>>> sure >>>> of the exact Felix version, but the org.osgi.framework version was set to >>>> 1.2) but is it possible that has become broken in recent releases? >>>> >>> >>> That is the version of the OSGi spec, check in the >>> org.apache.felix.framework.Felix.properties file... >>> >>> -> richard >>> >>>> Thanks >>>> >>>> Bruce >>>> >>>> On 30/04/2010 13:34, "Karl Pauls"<karlpa...@gmail.com> wrote: >>>> >>>> >>>>> In case you have problems on android not finding classes that you are >>>>> making available via the system bundle, make sure you set the >>>>> org.osgi.framework.bundle.parent property to the correct value (either >>>>> app or framework, depends). i.e., >>>>> >>>>> org.osgi.framework.bundle.parent=app >>>>> >>>>> or >>>>> >>>>> org.osgi.framework.bundle.parent=framework >>>>> >>>>> that should make it work. >>>>> >>>>> regards, >>>>> >>>>> Karl >>>>> >>>>> On Fri, Apr 30, 2010 at 1:38 PM, Jackson, Bruce<bru...@qualcomm.com> >>>>> wrote: >>>>> >>>>>> As a continuation to this mini-saga, I now have the initial problem (i.e. >>>>>> bundle resolution) fixed with the code below. When I add bundles to the >>>>>> running Felix framework, the resolve correctly, and start as long as >>>>>> their >>>>>> activator does not try to load any of the classes found in >>>>>> ANDROID_FRAMEWORK_PACKAGES, such as android.util.Log. If they do, I get a >>>>>> ClassNotFoundException: >>>>>> >>>>>> 04-30 12:36:25.788: DEBUG/dalvikvm(16018): Making a copy of >>>>>> Lcom/skifta/android/mediaserver/AndroidTestImpl;.test4 code (68 bytes) >>>>>> 04-30 12:36:25.798: WARN/System.err(16018): >>>>>> org.osgi.framework.BundleException: Activator start error in bundle >>>>>> com.skifta.booster.cdir [4]. >>>>>> 04-30 12:36:25.798: WARN/System.err(16018): at >>>>>> org.apache.felix.framework.Felix.activateBundle(Felix.java:1807) >>>>>> 04-30 12:36:25.798: WARN/System.err(16018): at >>>>>> org.apache.felix.framework.Felix.startBundle(Felix.java:1682) >>>>>> 04-30 12:36:25.798: WARN/System.err(16018): at >>>>>> org.apache.felix.framework.BundleImpl.start(BundleImpl.java:905) >>>>>> 04-30 12:36:25.798: WARN/System.err(16018): at >>>>>> org.apache.felix.framework.BundleImpl.start(BundleImpl.java:892) >>>>>> 04-30 12:36:25.798: WARN/System.err(16018): at >>>>>> com.skifta.android.client.SkiftaService.startOSGi(SkiftaService.java:401) >>>>>> .... >>>>>> 04-30 12:36:25.798: WARN/System.err(16018): Caused by: >>>>>> java.lang.NoClassDefFoundError: android.util.Log >>>>>> 04-30 12:36:25.798: WARN/System.err(16018): at >>>>>> com.skifta.android.mediaserver.AndroidTestImpl.test1(AndroidTestImpl.java:>>>>> >>>>>> 3 >>>>>> 3) >>>>>> 04-30 12:36:25.798: WARN/System.err(16018): at >>>>>> com.skifta.booster.cdir.Activator.start(Activator.java:43) >>>>>> 04-30 12:36:25.798: WARN/System.err(16018): at >>>>>> org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.j>>>>> >>>>>> a >>>>>> va >>>>>> :661) >>>>>> 04-30 12:36:25.798: WARN/System.err(16018): at >>>>>> org.apache.felix.framework.Felix.activateBundle(Felix.java:1760) >>>>>> 04-30 12:36:25.798: WARN/System.err(16018): ... 17 more >>>>>> >>>>>> >>>>>> Any idea why the classloader is not allowing bundles I start to see the >>>>>> classes in the packages exported by the framework? >>>>>> >>>>>> private static final String ANDROID_FRAMEWORK_PACKAGES = >>>>>> ("org.osgi.framework; version=1.4.0," + >>>>>> "org.osgi.service.packageadmin; version=1.2.0," + >>>>>> "org.osgi.service.startlevel; version=1.0.0," + >>>>>> "org.osgi.service.url; version=1.0.0," + >>>>>> "org.osgi.util.tracker," + >>>>>> "android; " + >>>>>> "android.app;" + >>>>>> "android.content;" + >>>>>> "android.database;" + >>>>>> "android.database.sqlite;" + >>>>>> "android.graphics; " + >>>>>> "android.graphics.drawable; " + >>>>>> "android.graphics.glutils; " + >>>>>> "android.hardware; " + >>>>>> "android.location; " + >>>>>> "android.media; " + >>>>>> "android.net; " + >>>>>> "android.net.wifi; " + >>>>>> "android.opengl; " + >>>>>> "android.os; " + >>>>>> "android.provider; " + >>>>>> "android.sax; " + >>>>>> "android.speech.recognition; " + >>>>>> "android.telephony; " + >>>>>> "android.telephony.gsm; " + >>>>>> "android.text; " + >>>>>> "android.text.method; " + >>>>>> "android.text.style; " + >>>>>> "android.text.util; " + >>>>>> "android.util; " + >>>>>> "android.view; " + >>>>>> "android.view.animation; " + >>>>>> "android.webkit; " + >>>>>> "android.widget; " + >>>>>> "com.google.android.maps; " + >>>>>> "com.google.android.xmppService; " + >>>>>> "javax.crypto; " + >>>>>> "javax.crypto.interfaces; " + >>>>>> "javax.crypto.spec; " + >>>>>> "javax.microedition.khronos.opengles; " + >>>>>> "javax.net; " + >>>>>> "javax.net.ssl; " + >>>>>> "javax.security.auth; " + >>>>>> "javax.security.auth.callback; " + >>>>>> "javax.security.auth.login; " + >>>>>> "javax.security.auth.x500; " + >>>>>> "javax.security.cert; " + >>>>>> "javax.sound.midi; " + >>>>>> "javax.sound.midi.spi; " + >>>>>> "javax.sound.sampled; " + >>>>>> "javax.sound.sampled.spi; " + >>>>>> "javax.sql; " + >>>>>> "javax.xml.parsers; " + >>>>>> "junit.extensions; " + >>>>>> "junit.framework; " + >>>>>> "org.apache.commons.codec; " + >>>>>> "org.apache.commons.codec.binary; " + >>>>>> "org.apache.commons.codec.language; " + >>>>>> "org.apache.commons.codec.net; " + >>>>>> "org.apache.commons.httpclient; " + >>>>>> "org.apache.commons.httpclient.auth; " + >>>>>> "org.apache.commons.httpclient.cookie; " + >>>>>> "org.apache.commons.httpclient.methods; " + >>>>>> "org.apache.commons.httpclient.methods.multipart; " + >>>>>> "org.apache.commons.httpclient.params; " + >>>>>> "org.apache.commons.httpclient.protocol; " + >>>>>> "org.apache.commons.httpclient.util; " + >>>>>> "org.json; " + >>>>>> "org.w3c.dom; " + >>>>>> "org.xml.sax; " + >>>>>> "org.xml.sax.ext; " + >>>>>> "org.xml.sax.helpers; " + >>>>>> "version=1.6.0"); >>>>>> >>>>>> Properties config = System.getProperties(); >>>>>> config.put("org.osgi.framework.startlevel.beginning", >>>>>> Integer.toString(SkiftaService.SKIFTA_START_LEVEL)); >>>>>> config.put("org.osgi.framework.storage.clean", "onFirstInit"); >>>>>> >>>>>> // make sure the OSGi cache dir is set to something sensible >>>>>> >>>>>> File cacheDir = this.getDir("osgi.cache", Context.MODE_PRIVATE); >>>>>> Log.d(TAG, "setting osgi cache location to: " + >>>>>> cacheDir.getAbsolutePath()); >>>>>> config.put("org.osgi.framework.storage", cacheDir.getAbsolutePath()); >>>>>> >>>>>> >>>>>> // calculate the export packages list from the environment >>>>>> >>>>>> String sysPackages = >>>>>> bootProps.getProperty("org.osgi.framework.system.packages.extra"); >>>>>> config.put("org.osgi.framework.system.packages", >>>>>> ANDROID_FRAMEWORK_PACKAGES); >>>>>> config.put("felix.log.level", "1"); >>>>>> >>>>>> // Now create an instance of the framework with >>>>>> // our configuration properties. >>>>>> >>>>>> Log.d(TAG, "Starting Felix..."); >>>>>> felix = new Felix(config); >>>>>> >>>>>> // Now start Felix instance. >>>>>> >>>>>> felix.start(); >>>>>> >>>>>> >>>>>> On 30/04/2010 11:30, "Bruce Jackson"<bru...@qualcomm.com> wrote: >>>>>> >>>>>> >>>>>>> Actually, the problem is one of syntax, apparently. When you pass in the >>>>>>> Properties object, the value against the key that was read from the file >>>>>>> attached (i.e. the standard form of these files) it doesn't work. >>>>>>> >>>>>>> The list needs to be comma separated with no additional CR LF characters >>>>>>> or >>>>>>> the parser doesn't do the right thing. >>>>>>> >>>>>>> Clearly there must be some form of pre-parsing going on to handle the >>>>>>> "standard" package lists in Felix. >>>>>>> >>>>>>> >>>>>>> On 29/04/2010 17:30, "Karl Pauls"<karlpa...@gmail.com> wrote: >>>>>>> >>>>>>> >>>>>>>> It should work, can you try to add a >>>>>>>> >>>>>>>> ; \ >>>>>>>> version=\"1.6.0\" >>>>>>>> >>>>>>>> to the end of your package list? i.e., >>>>>>>> >>>>>>>> org.xml.sax.ext; \ >>>>>>>> org.xml.sax.helpers; \ >>>>>>>> version=\"1.6.0\" >>>>>>>> >>>>>>>> >>>>>>>> regards, >>>>>>>> >>>>>>>> Karl >>>>>>>> >>>>>>>> On Wed, Apr 28, 2010 at 7:41 PM, Jackson, Bruce<bru...@qualcomm.com> >>>>>>>> wrote: >>>>>>>> >>>>>>>>> Hi All >>>>>>>>> >>>>>>>>> I have Felix embedded into an Android app, and I'm trying to export >>>>>>>>> the >>>>>>>>> packages from the Android environment (e.g. android, android.app, etc) >>>>>>>>> into >>>>>>>>> Felix. >>>>>>>>> >>>>>>>>> I have a couple of questions: first, can I still use the pre-4.2 >>>>>>>>> constructor: >>>>>>>>> >>>>>>>>> Felix felix = new Felix(Properties props); >>>>>>>>> >>>>>>>>> ...and if I do so passing in a properties file which contains a >>>>>>>>> semicolon-seperated list of packages as per the attached, should I see >>>>>>>>> this >>>>>>>>> working properly? >>>>>>>>> >>>>>>>>> Felix starts ok, but when I try to deploy any bundles to it (for >>>>>>>>> example >>>>>>>>> a >>>>>>>>> dexified org.apache.log4j) I get a message fro the debugger when I >>>>>>>>> call: >>>>>>>>> >>>>>>>>> BundleContent bc = felix.getBundleContent(); >>>>>>>>> bc.installBundle(name, inputStream); >>>>>>>>> >>>>>>>>> 04-28 18:31:45.716: ERROR/SkiftaService(6274): Unresolved constraint >>>>>>>>> in >>>>>>>>> bundle org.apache.log4j [1]: package; (package=javax.xml.parsers) >>>>>>>>> >>>>>>>>> ...which seems to suggest that it can't find the package. >>>>>>>>> >>>>>>>>> Any ideas? >>>>>>>>> >>>>>>>>> Thanks >>>>>>>>> >>>>>>>>> Bruce >>>>>>>>> >>>>>>>>> >>>>>>>>> >>>>>>>> >>>>>>>> >>>>>>> >>>>>> >>>>> >>>>> >>>> >> > -- Karl Pauls karlpa...@gmail.com