Further investigationf of the Android logs revels the following message which appears just after calling Felix.start():
04-30 15:01:16.977: WARN/System.err(18939): Problem creating boot delegation class loader: java.lang.reflect.InvocationTargetException 04-30 15:01:17.117: WARN/System.err(18939): ClassLoader = dalvik.system.PathClassLoader - dalvik.system.pathclassloa...@46502120 04-30 15:01:17.187: WARN/System.err(245): java.io.IOException: Error running exec(). Commands: [/system/xbin/su, 0, /system/bin/rm, /data/local/tmp/com.skifta.android.apk] Working Directory: null Environment: null 04-30 15:01:17.187: WARN/System.err(245): at java.lang.ProcessManager.exec(ProcessManager.java:196) 04-30 15:01:17.187: WARN/System.err(245): at java.lang.Runtime.exec(Runtime.java:225) 04-30 15:01:17.187: WARN/System.err(245): at java.lang.Runtime.exec(Runtime.java:313) 04-30 15:01:17.187: WARN/System.err(245): at java.lang.Runtime.exec(Runtime.java:246) 04-30 15:01:17.187: WARN/System.err(245): at com.htc.android.psclient.PackageInstallationReceiver.removeTempPackageFile(P ackageInstallationReceiver.java:34) 04-30 15:01:17.187: WARN/System.err(245): at com.htc.android.psclient.PackageInstallationReceiver.access$000(PackageInsta llationReceiver.java:8) 04-30 15:01:17.187: WARN/System.err(245): at com.htc.android.psclient.PackageInstallationReceiver$1.run(PackageInstallati onReceiver.java:24) 04-30 15:01:17.187: WARN/System.err(245): Caused by: java.io.IOException: No such file or directory 04-30 15:01:17.197: WARN/System.err(245): at java.lang.ProcessManager.exec(Native Method) 04-30 15:01:17.197: WARN/System.err(245): at java.lang.ProcessManager.exec(ProcessManager.java:194) 04-30 15:01:17.197: WARN/System.err(245): ... 6 more On 30/04/2010 14:50, "Bruce Jackson" <bru...@qualcomm.com> 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? > > 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:33>>> ) >>> 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.jav>>> a >>> :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 >>>>>> >>>>>> >>>>> >>>>> >>>> >>> >> >> >