felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jackson, Bruce" <bru...@qualcomm.com>
Subject Re: org.osgi.framework.system.packages and Felix embedded in Android
Date Fri, 30 Apr 2010 16:14:07 GMT
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" <heavy@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"<karlpauls@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<brucej@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.ja
>>>> 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"<brucej@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"<karlpauls@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<brucej@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
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>>> 
>>> 
>> 


Mime
View raw message