Actually, I cannot include commons logging as a jar in the APK. dx
complains about the fact that it already has the main interface for Log and
I can't add anything else.

And since the bytecodes are different between android and my code, I will
have to change my build system to use the bundle when not android and use
android when android.

Sigh.



On Thu, Nov 1, 2012 at 9:59 AM, Keith Hughes <[email protected]>wrote:

> OK, thanks Karl. I was beginning to think I might be stuck with something
> like that.
>
> One advantage, though, I suppose, is my bootstrap system can use the
> logging framework for itself.
>
> I will try and see if it solves my problem. I will respond one way or the
> other.
>
>
>
> On Thu, Nov 1, 2012 at 2:31 AM, Karl Pauls <[email protected]> wrote:
>
>> Part of your problem is that android/davlik is not Java. It doesn't
>> follow normal Java classloading rules. Where that bites us from an
>> OSGi pov is that you can't just substitute providers. In your case,
>> you might be able to get things to work by removing the imports of
>> bundles to commons logging but typically the only way to make things
>> work is to make sure you only have one provider of a given package --
>> hence, I'd remove commons logging from all bundles and put it in the
>> apk itself and have it bootdelegated.
>>
>> regards,
>>
>> Karl
>>
>> On Wed, Oct 31, 2012 at 11:05 PM, Keith Hughes <[email protected]>
>> wrote:
>> > Hi folks,
>> >
>> > I have an Android application based on Apache Felix. Everything works
>> fine
>> > when I run things on Linux, but as soon as I try moving to Android I run
>> > into a problem.
>> >
>> > My app uses Apache Commons Logging in all of its bundles. I have
>> included a
>> > bundle for Apache Commons Logging as a bundle as well.
>> >
>> > When the container starts up I get the following stack trace which
>> seems to
>> > point out that it is accessing the org/apache/commons/logging/Log in the
>> > Android system libraries.
>> > <
>> https://mail.google.com/mail/?view=cm&fs=1&tf=1&source=mailto&[email protected]
>> >
>> > 10-31 15:43:53.251: W/dalvikvm(5034): Class resolved by unexpected DEX:
>> > Linterac
>> >
>> tivespaces/configuration/FileSystemConfigurationStorageManager;(0x41747380):0x64
>> > d0b000 ref [Lorg/apache/commons/logging/Log;]
>> > Lorg/apache/commons/logging/Log;(0x417498d8):0x64d34000
>> > 10-31 15:43:53.251: W/dalvikvm(5034):
>> > (Linteractivespaces/configuration/FileSystemConfigurationStorageManager;
>> > had used a different Lorg/apache/commons/logging/Log; during
>> > pre-verification)
>> > 10-31 15:43:53.251: W/System.err(5034): Exception
>> > bootstrap/interactivespaces-system-1.2.0.jar
>> > 10-31 15:43:53.251: W/System.err(5034):
>> org.osgi.framework.BundleException:
>> > Activator start error in bundle interactivespaces.system [24].
>> > 10-31 15:43:53.251: W/System.err(5034):         at
>> > org.apache.felix.framework.Felix.activateBundle(Felix.java:2027)
>> > 10-31 15:43:53.251: W/System.err(5034):         at
>> > org.apache.felix.framework.Felix.startBundle(Felix.java:1895)
>> > 10-31 15:43:53.251: W/System.err(5034):         at
>> > org.apache.felix.framework.BundleImpl.start(BundleImpl.java:944)
>> > 10-31 15:43:53.251: W/System.err(5034):         at
>> > org.apache.felix.framework.BundleImpl.start(BundleImpl.java:931)
>> > 10-31 15:43:53.251: W/System.err(5034):         at
>> >
>> interactivespaces.android.service.InteractiveSpacesFrameworkAndroidBootstrap.startBundle(InteractiveSpacesFrameworkAndroidBootstrap.java:188)
>> > 10-31 15:43:53.251: W/System.err(5034):         at
>> >
>> interactivespaces.android.service.InteractiveSpacesFrameworkAndroidBootstrap.startBundles(InteractiveSpacesFrameworkAndroidBootstrap.java:173)
>> > 10-31 15:43:53.251: W/System.err(5034):         at
>> >
>> interactivespaces.android.service.InteractiveSpacesFrameworkAndroidBootstrap.boot(InteractiveSpacesFrameworkAndroidBootstrap.java:124)
>> > 10-31 15:43:53.261: W/System.err(5034):         at
>> >
>> interactivespaces.android.service.InteractiveSpacesService.onStartCommand(InteractiveSpacesService.java:67)
>> > 10-31 15:43:53.261: W/System.err(5034):         at
>> > android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2490)
>> > 10-31 15:43:53.261: W/System.err(5034):         at
>> > android.app.ActivityThread.access$1900(ActivityThread.java:130)
>> > 10-31 15:43:53.261: W/System.err(5034):         at
>> > android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292)
>> > 10-31 15:43:53.261: W/System.err(5034):         at
>> > android.os.Handler.dispatchMessage(Handler.java:99)
>> > 10-31 15:43:53.261: W/System.err(5034):         at
>> > android.os.Looper.loop(Looper.java:137)
>> > 10-31 15:43:53.261: W/System.err(5034):         at
>> > android.app.ActivityThread.main(ActivityThread.java:4745)
>> > 10-31 15:43:53.261: W/System.err(5034):         at
>> > java.lang.reflect.Method.invokeNative(Native Method)
>> > 10-31 15:43:53.261: W/System.err(5034):         at
>> > java.lang.reflect.Method.invoke(Method.java:511)
>> > 10-31 15:43:53.261: W/System.err(5034):         at
>> >
>> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
>> > 10-31 15:43:53.261: W/System.err(5034):         at
>> > com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
>> > 10-31 15:43:53.261: W/System.err(5034):         at
>> > dalvik.system.NativeStart.main(Native Method)
>> > 10-31 15:43:53.261: W/System.err(5034): Caused by:
>> > java.lang.IllegalAccessError: Class ref in pre-verified class resolved
>> to
>> > unexpected implementation
>> > 10-31 15:43:53.261: W/System.err(5034):         at
>> >
>> interactivespaces.configuration.FileSystemConfigurationStorageManager.loadConfigFile(FileSystemConfigurationStorageManager.java:105)
>> > 10-31 15:43:53.261: W/System.err(5034):         at
>> >
>> interactivespaces.configuration.FileSystemConfigurationStorageManager.startup(FileSystemConfigurationStorageManager.java:82)
>> > 10-31 15:43:53.261: W/System.err(5034):         at
>> >
>> interactivespaces.system.bootstrap.osgi.GeneralInteractiveSpacesSupportActivator.setupSystemConfiguration(GeneralInteractiveSpacesSupportActivator.java:315)
>> > 10-31 15:43:53.261: W/System.err(5034):         at
>> >
>> interactivespaces.system.bootstrap.osgi.GeneralInteractiveSpacesSupportActivator.setupSpaceEnvironment(GeneralInteractiveSpacesSupportActivator.java:216)
>> > 10-31 15:43:53.261: W/System.err(5034):         at
>> >
>> interactivespaces.system.bootstrap.osgi.GeneralInteractiveSpacesSupportActivator.start(GeneralInteractiveSpacesSupportActivator.java:143)
>> > 10-31 15:43:53.261: W/System.err(5034):         at
>> >
>> org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645)
>> > 10-31 15:43:53.261: W/System.err(5034):         at
>> > org.apache.felix.framework.Felix.activateBundle(Felix.java:1977)
>> > 10-31 15:43:53.261: W/System.err(5034):         ... 18 more
>> >
>> > I have tried experimenting with all of the legal values of the Bundle
>> > Parent configuration property to no avail.
>> >
>> > How can I tell Felix to ignore Commons Logging from the system boot path
>> > and only use the one from the bundle?
>>
>>
>>
>> --
>> Karl Pauls
>> [email protected]
>> http://twitter.com/karlpauls
>> http://www.linkedin.com/in/karlpauls
>> https://profiles.google.com/karlpauls
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [email protected]
>> For additional commands, e-mail: [email protected]
>>
>>
>

Reply via email to