You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@felix.apache.org by pablomj <pa...@hotmail.es> on 2010/02/12 12:32:00 UTC

Re: Felix on Android

Hi Bruce, I am trying the same, but I don't have the solution yet.
Do you have some advance?
Salutations, thanks.
Pablo.


Jackson, Bruce wrote:
> 
> The Felix site has a useful section on getting things going on Android (
> http://felix.apache.org/site/apache-felix-and-google-android.html) but
> isn't
> so clear about embedding the framework into an Android app"
> 
> "Apache Felix can also be integrated with an Android application. To
> achieve
> this, you need to embed Felix into onCreate() method of your Activity
> class
> (see Android docs for more details on how to use an Activity) and process
> your bundles as shown above."
> 
> Has anyone got an example of how you do this? I understand how to write
> the
> Android app, and I get the point being made here. What I need to
> understand
> is:
> 
> 1. How do you launch the Felix framework. What do I need to instantiate?
> 2. Where does the framework get its boot configuration (i.e. what bundles
> to
> load, run levels, environment variables, etc) from in this case?
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Felix-on-Android-tp27245141p27562212.html
Sent from the Apache Felix - Dev mailing list archive at Nabble.com.


Re: Felix on Android

Posted by Clement Escoffier <cl...@gmail.com>.
Hi,

I have several configurations running on Android with plain Felix bundles (not recompiled just dexified) like iPOJO, the HTTP Service and the web console...
I noticed some issue with some specific bundles like the config admin (opcode rejected) but this does not come from the java code source level. 

Regards,

Clement

On 12.02.2010, at 16:25, Karl Pauls wrote:

> On Fri, Feb 12, 2010 at 4:22 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>> I'm taking here about the ad-on bundles (like http, for example) rather than
>> the framework. The dx tool needs to have classes that were compiled with a
>> "new" compiler (i.e. greater than 1.5).
> 
> Since when? Always worked for me. Again, the framework itself is
> compiled for 1.3...
> 
> regards,
> 
> Karl
> 
>> Thanks
>> 
>> Bruce
>> 
>> 
>> On 12/02/2010 13:33, "Karl Pauls" <ka...@gmail.com> wrote:
>> 
>>> Why would you need 1.5 to be able to dex the bundle (the framework
>>> itself is build for 1.3 btw.)?
>>> 
>>> regards,
>>> 
>>> Karl
>>> 
>>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>>>> Hi Pablo
>>>> 
>>>> See the attached code. The biggest problem I've encountered is that the
>>>> Felix distribution is a huge pain to build under JDK 1.5, and therefore to
>>>> be able to use some of the bundles (for example the http service) that are
>>>> part of the distribution. Its not a simple job of just changing a couple of
>>>> entries in POM files: some components download pre-built JAR files from the
>>>> web and explode these, thereby having classes built under 1.4 which will not
>>>> work when you dexify the bundles.
>>>> 
>>>> This is something that would be great to see some work done on by the Felix
>>>> community, because while its true that the basic Felix core does and will
>>>> support Android, most of the add-on bundles wont.
>>>> 
>>>> For my part, the ideal solution would be to see the whole framework be based
>>>> on JDK 1.5 and not 1.4.
>>>> 
>>>> Thanks
>>>> 
>>>> Bruce
>>>> 
>>>> 
>>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>>> 
>>>>> 
>>>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>>>> Do you have some advance?
>>>>> Salutations, thanks.
>>>>> Pablo.
>>>>> 
>>>>> 
>>>>> Jackson, Bruce wrote:
>>>>>> 
>>>>>> The Felix site has a useful section on getting things going on Android (
>>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html) but
>>>>>> isn't
>>>>>> so clear about embedding the framework into an Android app"
>>>>>> 
>>>>>> "Apache Felix can also be integrated with an Android application. To
>>>>>> achieve
>>>>>> this, you need to embed Felix into onCreate() method of your Activity
>>>>>> class
>>>>>> (see Android docs for more details on how to use an Activity) and process
>>>>>> your bundles as shown above."
>>>>>> 
>>>>>> Has anyone got an example of how you do this? I understand how to write
>>>>>> the
>>>>>> Android app, and I get the point being made here. What I need to
>>>>>> understand
>>>>>> is:
>>>>>> 
>>>>>> 1. How do you launch the Felix framework. What do I need to instantiate?
>>>>>> 2. Where does the framework get its boot configuration (i.e. what bundles
>>>>>> to
>>>>>> load, run levels, environment variables, etc) from in this case?
>>>>>> 
>>>>>> 
>>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 
> 
> -- 
> Karl Pauls
> karlpauls@gmail.com


Re: Felix on Android

Posted by "Jackson, Bruce" <br...@qualcomm.com>.
Ok, I'm now using 2.0.3 on the Nexus. I've downloaded the jar for HTTP Service Jetty  2.0.4 from the Felix site, and have dexified it as follows:

$ dx -JXms1024M -JXmx2048M --dex --output=classes.dex org.apache.felix.http.jetty-2.0.4.jar
$ aapt add org.apache.felix.http.jetty-2.0.4.jar classes.dex

I’ve transferred the bundle to tha handset, and then I start the framework:

# sh felix.sh

Welcome to Felix
================

Feb 15, 2010 11:26:28 AM java.io.BufferedReader <init>
INFO: Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
Problem creating boot delegation class loader: java.lang.reflect.InvocationTargetException
Feb 15, 2010 11:26:28 AM java.io.BufferedReader <init>
INFO: Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 15, 2010 11:26:28 AM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 15, 2010 11:26:28 AM java.io.BufferedReader <init>
INFO: Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 15, 2010 11:26:28 AM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 15, 2010 11:26:28 AM java.io.BufferedReader <init>
INFO: Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 15, 2010 11:26:28 AM java.io.BufferedReader <init>
INFO: Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 15, 2010 11:26:28 AM java.io.BufferedReader <init>
INFO: Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 15, 2010 11:26:28 AM java.io.BufferedReader <init>
INFO: Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 15, 2010 11:26:28 AM java.io.BufferedReader <init>
INFO: Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 15, 2010 11:26:28 AM java.io.BufferedReader <init>
INFO: Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 15, 2010 11:26:28 AM java.io.BufferedReader <init>
INFO: Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 15, 2010 11:26:28 AM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 15, 2010 11:26:28 AM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 15, 2010 11:26:28 AM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 15, 2010 11:26:28 AM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
DEBUG: WIRE: 1.0 -> org.osgi.service.startlevel -> 0
DEBUG: WIRE: 1.0 -> org.osgi.framework -> 0
DEBUG: WIRE: 1.0 -> org.osgi.service.packageadmin -> 0
DEBUG: WIRE: 2.0 -> org.osgi.framework -> 0
DEBUG: WIRE: 2.0 -> org.apache.felix.shell -> 1.0
Feb 15, 2010 11:26:28 AM java.io.BufferedReader <init>
INFO: Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
-> ps
START LEVEL 1
   ID   State         Level  Name
[   0] [Active     ] [    0] System Bundle (2.0.3)
Feb 15, 2010 11:26:30 AM java.io.BufferedReader <init>
INFO: Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
[   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
Feb 15, 2010 11:26:30 AM java.io.BufferedReader <init>
INFO: Default buffer size used in BufferedReader constructor. It would be better to be explicit if an 8k-char buffer is required.
[   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
-> install file:bundle/org.apache.felix.http.jetty-2.0.4.jar
Feb 15, 2010 11:26:38 AM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 15, 2010 11:26:38 AM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 15, 2010 11:26:38 AM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 15, 2010 11:26:39 AM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 15, 2010 11:26:39 AM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 15, 2010 11:26:39 AM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
Bundle ID: 4
-> ps
START LEVEL 1
   ID   State         Level  Name
[   0] [Active     ] [    0] System Bundle (2.0.3)
[   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
[   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
[   4] [Installed  ] [    1] Apache Felix Http Jetty (2.0.4)
-> start 4
Feb 15, 2010 11:26:45 AM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
DEBUG: WIRE: 4.0 -> javax.xml.parsers -> 0
DEBUG: WIRE: 4.0 -> org.xml.sax -> 0
DEBUG: WIRE: 4.0 -> javax.security.cert -> 0
DEBUG: WIRE: 4.0 -> org.osgi.util.tracker -> 0
DEBUG: WIRE: 4.0 -> org.osgi.framework -> 0
DEBUG: WIRE: 4.0 -> javax.net.ssl -> 0
DEBUG: WIRE: 4.0 -> org.xml.sax.helpers -> 0
org.osgi.framework.BundleException: Activator start error in bundle org.apache.felix.http.jetty [4].
    at org.apache.felix.framework.Felix.activateBundle(Felix.java:1803)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1678)
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:905)
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:892)
    at org.apache.felix.shell.impl.StartCommandImpl.execute(StartCommandImpl.java:82)
    at org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Activator.java:276)
    at org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Activator.java:167)
    at java.lang.Thread.run(Thread.java:1096)
Caused by: java.lang.NoClassDefFoundError: org.apache.felix.http.base.internal.logger.LogServiceLogger
    at org.apache.felix.http.base.internal.AbstractActivator.start(AbstractActivator.java:39)
    at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:661)
    at org.apache.felix.framework.Felix.activateBundle(Felix.java:1756)
    ... 7 more
java.lang.NoClassDefFoundError: org.apache.felix.http.base.internal.logger.LogServiceLogger
->

I’ve exploded the org.apache.felix.http.jetty jar file, so I can see the class is certainly there. This is why I assumed that this was a compiler issue, whereby dx was ignorning certain classes. Any ideas?

Thanks

Bruce

On 12/02/2010 22:08, "Karl Pauls" <ka...@gmail.com> wrote:

> Well, the first thing to try is to use the latest version of felix.
> You are using 1.4.0 which for sure had a lot of not addressed issues
> on android. I fixed a couple of bugs and reimplemented all of the
> classloading in later versions. My guess would be that this is your
> problem and not some compiler thing. Can you try with felix 2.0.2 and
> 2.0.3 plus get me the logcat output if it doesn't work?
>
> regards,
>
> Karl
>
> On Fri, Feb 12, 2010 at 5:27 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>> I've got the Felix framework installed on my Nexus. If I download the
>> org.apache.felix.http.jetty-2.0.4.jar bundle from the Felix site, dx it
>> (which generates piles of warnings) push it to the phone, start Felix and
>> then install the jetty bundle, Felix just hangs:
>>
>> -> ps
>> START LEVEL 1
>>   ID   State         Level  Name
>> [   0] [Active     ] [    0] System Bundle (1.4.0)
>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
>> [   3] [Active     ] [    1] JDOM (1.0.0.v200803070505)
>> -> install file:bundle/org.apache.felix.http.jetty-2.0.4.jar
>> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>> better to be explicit if an 8k-char buffer is required.
>> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>> better to be explicit if an 8k-char buffer is required.
>> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>> better to be explicit if an 8k-char buffer is required.
>> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>> better to be explicit if an 8k-char buffer is required.
>> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>> better to be explicit if an 8k-char buffer is required.
>> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>> better to be explicit if an 8k-char buffer is required.
>> Bundle ID: 5
>> -> ps
>> START LEVEL 1
>>   ID   State         Level  Name
>> [   0] [Active     ] [    0] System Bundle (1.4.0)
>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
>> [   3] [Active     ] [    1] JDOM (1.0.0.v200803070505)
>> [   5] [Installed  ] [    1] Apache Felix Http Jetty (2.0.4)
>> -> start 5
>> Feb 12, 2010 4:15:08 PM java.io.BufferedWriter <init>
>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>> better to be explicit if an 8k-char buffer is required.
>> DEBUG: WIRE: 5.0 -> javax.xml.parsers -> 0
>> DEBUG: WIRE: 5.0 -> org.xml.sax -> 0
>> DEBUG: WIRE: 5.0 -> javax.servlet.resources -> 5.0
>> DEBUG: WIRE: 5.0 -> javax.servlet -> 5.0
>> DEBUG: WIRE: 5.0 -> javax.security.cert -> 0
>> DEBUG: WIRE: 5.0 -> org.osgi.util.tracker -> 0
>> DEBUG: WIRE: 5.0 -> org.osgi.framework -> 0
>> DEBUG: WIRE: 5.0 -> javax.servlet.jsp.resources -> 5.0
>> DEBUG: WIRE: 5.0 -> javax.net.ssl -> 0
>> DEBUG: WIRE: 5.0 -> org.xml.sax.helpers -> 0
>> DEBUG: WIRE: 5.0 -> org.osgi.service.http -> 5.0
>> DEBUG: WIRE: 5.0 -> org.apache.felix.http.api -> 5.0
>> DEBUG: WIRE: 5.0 -> javax.servlet.http -> 5.0
>>
>> At this point, I have to CTRL-C to kill Felix. The same thing happened before
>> I compiled JDOM with 1.5+. I might be missing something, but my assumption,
>> perhaps wrong, was that it was the compiler version that was causing this
>> behavior?
>>
>> Thanks
>>
>> Bruce
>>
>>
>>
>>
>>
>>
>> On 12/02/2010 15:51, "Clement Escoffier" <cl...@gmail.com> wrote:
>>
>>>
>>> On 12.02.2010, at 16:45, Jackson, Bruce wrote:
>>>
>>>> Whenever you dx a bundle which has been built with a pre-1.5 compiler you
>>>> will usually get a pile of:
>>>>
>>>> warning: Ignoring InnerClasses attribute for an anonymous inner class that
>>>> doesn't come with an associated EnclosingMethod attribute. (This class was
>>>> probably produced by a broken compiler.)
>>>>
>>>> ...messages (assuming that you do use inner classes in the bundle). These
>>>> are generated because the bundle was compiled with a pre-1.5 compiler. With
>>>> something like the org.jdom bundle, the bundle will not work correctly if
>>>> it
>>>> was compiled with a pre-1.5 compiler and then dx-ed, while using a post-1.5
>>>> it does.
>>>>
>>>> It may a be a broad assessment of the situation, but I took this experience
>>>> to indicate that it was required to build bundles with a post-1.5 compiler.
>>>> Indeed if you look around the web, you'll see this warning mentioned in
>>>> relation to a number of problems people are having with getting apps
>>>> running
>>>> on Android, when using JARs that were compiled pre-1.5.
>>>
>>> Well, you got less messages if you compile with 1.5+, but that's does say
>>> that
>>> a bundle will not work.
>>> When dexifying iPOJO, I have a couple of message too, but the complete iPOJO
>>> test suite works on Android (except some features using on the fly bytecode
>>> generation).
>>>
>>> Regards,
>>>
>>> Clement
>>>
>>>
>>>
>>>>
>>>> Thanks
>>>>
>>>> Bruce
>>>>
>>>> On 12/02/2010 15:25, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>
>>>>> On Fri, Feb 12, 2010 at 4:22 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>> wrote:
>>>>>> I'm taking here about the ad-on bundles (like http, for example) rather
>>>>>> than
>>>>>> the framework. The dx tool needs to have classes that were compiled with >>>>>> a
>>>>>> "new" compiler (i.e. greater than 1.5).
>>>>>
>>>>> Since when? Always worked for me. Again, the framework itself is
>>>>> compiled for 1.3...
>>>>>
>>>>> regards,
>>>>>
>>>>> Karl
>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Bruce
>>>>>>
>>>>>>
>>>>>> On 12/02/2010 13:33, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>>>
>>>>>>> Why would you need 1.5 to be able to dex the bundle (the framework
>>>>>>> itself is build for 1.3 btw.)?
>>>>>>>
>>>>>>> regards,
>>>>>>>
>>>>>>> Karl
>>>>>>>
>>>>>>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>>>> wrote:
>>>>>>>> Hi Pablo
>>>>>>>>
>>>>>>>> See the attached code. The biggest problem I've encountered is that the
>>>>>>>> Felix distribution is a huge pain to build under JDK 1.5, and therefore
>>>>>>>> to
>>>>>>>> be able to use some of the bundles (for example the http service) that
>>>>>>>> are
>>>>>>>> part of the distribution. Its not a simple job of just changing a
>>>>>>>> couple
>>>>>>>> of
>>>>>>>> entries in POM files: some components download pre-built JAR files from
>>>>>>>> the
>>>>>>>> web and explode these, thereby having classes built under 1.4 which
>>>>>>>> will
>>>>>>>> not
>>>>>>>> work when you dexify the bundles.
>>>>>>>>
>>>>>>>> This is something that would be great to see some work done on by the
>>>>>>>> Felix
>>>>>>>> community, because while its true that the basic Felix core does and
>>>>>>>> will
>>>>>>>> support Android, most of the add-on bundles wont.
>>>>>>>>
>>>>>>>> For my part, the ideal solution would be to see the whole framework be
>>>>>>>> based
>>>>>>>> on JDK 1.5 and not 1.4.
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>>
>>>>>>>> Bruce
>>>>>>>>
>>>>>>>>
>>>>>>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>>>>>>>> Do you have some advance?
>>>>>>>>> Salutations, thanks.
>>>>>>>>> Pablo.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Jackson, Bruce wrote:
>>>>>>>>>>
>>>>>>>>>> The Felix site has a useful section on getting things going on
>>>>>>>>>> Android >>>>>>>> (
>>>>>>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html)
>>>>>>>>>> but
>>>>>>>>>> isn't
>>>>>>>>>> so clear about embedding the framework into an Android app"
>>>>>>>>>>
>>>>>>>>>> "Apache Felix can also be integrated with an Android application. To
>>>>>>>>>> achieve
>>>>>>>>>> this, you need to embed Felix into onCreate() method of your Activity
>>>>>>>>>> class
>>>>>>>>>> (see Android docs for more details on how to use an Activity) and
>>>>>>>>>> process
>>>>>>>>>> your bundles as shown above."
>>>>>>>>>>
>>>>>>>>>> Has anyone got an example of how you do this? I understand how to
>>>>>>>>>> write
>>>>>>>>>> the
>>>>>>>>>> Android app, and I get the point being made here. What I need to
>>>>>>>>>> understand
>>>>>>>>>> is:
>>>>>>>>>>
>>>>>>>>>> 1. How do you launch the Felix framework. What do I need to
>>>>>>>>>> instantiate?
>>>>>>>>>> 2. Where does the framework get its boot configuration (i.e. what
>>>>>>>>>> bundles
>>>>>>>>>> to
>>>>>>>>>> load, run levels, environment variables, etc) from in this case?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>
>

Re: Felix on Android

Posted by Karl Pauls <ka...@gmail.com>.
Well, the first thing to try is to use the latest version of felix.
You are using 1.4.0 which for sure had a lot of not addressed issues
on android. I fixed a couple of bugs and reimplemented all of the
classloading in later versions. My guess would be that this is your
problem and not some compiler thing. Can you try with felix 2.0.2 and
2.0.3 plus get me the logcat output if it doesn't work?

regards,

Karl

On Fri, Feb 12, 2010 at 5:27 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
> I've got the Felix framework installed on my Nexus. If I download the org.apache.felix.http.jetty-2.0.4.jar bundle from the Felix site, dx it (which generates piles of warnings) push it to the phone, start Felix and then install the jetty bundle, Felix just hangs:
>
> -> ps
> START LEVEL 1
>   ID   State         Level  Name
> [   0] [Active     ] [    0] System Bundle (1.4.0)
> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
> [   3] [Active     ] [    1] JDOM (1.0.0.v200803070505)
> -> install file:bundle/org.apache.felix.http.jetty-2.0.4.jar
> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
> INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
> INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
> INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
> INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
> INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
> INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
> Bundle ID: 5
> -> ps
> START LEVEL 1
>   ID   State         Level  Name
> [   0] [Active     ] [    0] System Bundle (1.4.0)
> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
> [   3] [Active     ] [    1] JDOM (1.0.0.v200803070505)
> [   5] [Installed  ] [    1] Apache Felix Http Jetty (2.0.4)
> -> start 5
> Feb 12, 2010 4:15:08 PM java.io.BufferedWriter <init>
> INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
> DEBUG: WIRE: 5.0 -> javax.xml.parsers -> 0
> DEBUG: WIRE: 5.0 -> org.xml.sax -> 0
> DEBUG: WIRE: 5.0 -> javax.servlet.resources -> 5.0
> DEBUG: WIRE: 5.0 -> javax.servlet -> 5.0
> DEBUG: WIRE: 5.0 -> javax.security.cert -> 0
> DEBUG: WIRE: 5.0 -> org.osgi.util.tracker -> 0
> DEBUG: WIRE: 5.0 -> org.osgi.framework -> 0
> DEBUG: WIRE: 5.0 -> javax.servlet.jsp.resources -> 5.0
> DEBUG: WIRE: 5.0 -> javax.net.ssl -> 0
> DEBUG: WIRE: 5.0 -> org.xml.sax.helpers -> 0
> DEBUG: WIRE: 5.0 -> org.osgi.service.http -> 5.0
> DEBUG: WIRE: 5.0 -> org.apache.felix.http.api -> 5.0
> DEBUG: WIRE: 5.0 -> javax.servlet.http -> 5.0
>
> At this point, I have to CTRL-C to kill Felix. The same thing happened before I compiled JDOM with 1.5+. I might be missing something, but my assumption, perhaps wrong, was that it was the compiler version that was causing this behavior?
>
> Thanks
>
> Bruce
>
>
>
>
>
>
> On 12/02/2010 15:51, "Clement Escoffier" <cl...@gmail.com> wrote:
>
>>
>> On 12.02.2010, at 16:45, Jackson, Bruce wrote:
>>
>>> Whenever you dx a bundle which has been built with a pre-1.5 compiler you
>>> will usually get a pile of:
>>>
>>> warning: Ignoring InnerClasses attribute for an anonymous inner class that
>>> doesn't come with an associated EnclosingMethod attribute. (This class was
>>> probably produced by a broken compiler.)
>>>
>>> ...messages (assuming that you do use inner classes in the bundle). These
>>> are generated because the bundle was compiled with a pre-1.5 compiler. With
>>> something like the org.jdom bundle, the bundle will not work correctly if it
>>> was compiled with a pre-1.5 compiler and then dx-ed, while using a post-1.5
>>> it does.
>>>
>>> It may a be a broad assessment of the situation, but I took this experience
>>> to indicate that it was required to build bundles with a post-1.5 compiler.
>>> Indeed if you look around the web, you'll see this warning mentioned in
>>> relation to a number of problems people are having with getting apps running
>>> on Android, when using JARs that were compiled pre-1.5.
>>
>> Well, you got less messages if you compile with 1.5+, but that's does say that
>> a bundle will not work.
>> When dexifying iPOJO, I have a couple of message too, but the complete iPOJO
>> test suite works on Android (except some features using on the fly bytecode
>> generation).
>>
>> Regards,
>>
>> Clement
>>
>>
>>
>>>
>>> Thanks
>>>
>>> Bruce
>>>
>>> On 12/02/2010 15:25, "Karl Pauls" <ka...@gmail.com> wrote:
>>>
>>>> On Fri, Feb 12, 2010 at 4:22 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>>>>> I'm taking here about the ad-on bundles (like http, for example) rather
>>>>> than
>>>>> the framework. The dx tool needs to have classes that were compiled with a
>>>>> "new" compiler (i.e. greater than 1.5).
>>>>
>>>> Since when? Always worked for me. Again, the framework itself is
>>>> compiled for 1.3...
>>>>
>>>> regards,
>>>>
>>>> Karl
>>>>
>>>>> Thanks
>>>>>
>>>>> Bruce
>>>>>
>>>>>
>>>>> On 12/02/2010 13:33, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>>
>>>>>> Why would you need 1.5 to be able to dex the bundle (the framework
>>>>>> itself is build for 1.3 btw.)?
>>>>>>
>>>>>> regards,
>>>>>>
>>>>>> Karl
>>>>>>
>>>>>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>>> wrote:
>>>>>>> Hi Pablo
>>>>>>>
>>>>>>> See the attached code. The biggest problem I've encountered is that the
>>>>>>> Felix distribution is a huge pain to build under JDK 1.5, and therefore
>>>>>>> to
>>>>>>> be able to use some of the bundles (for example the http service) that
>>>>>>> are
>>>>>>> part of the distribution. Its not a simple job of just changing a couple
>>>>>>> of
>>>>>>> entries in POM files: some components download pre-built JAR files from
>>>>>>> the
>>>>>>> web and explode these, thereby having classes built under 1.4 which will
>>>>>>> not
>>>>>>> work when you dexify the bundles.
>>>>>>>
>>>>>>> This is something that would be great to see some work done on by the
>>>>>>> Felix
>>>>>>> community, because while its true that the basic Felix core does and will
>>>>>>> support Android, most of the add-on bundles wont.
>>>>>>>
>>>>>>> For my part, the ideal solution would be to see the whole framework be
>>>>>>> based
>>>>>>> on JDK 1.5 and not 1.4.
>>>>>>>
>>>>>>> Thanks
>>>>>>>
>>>>>>> Bruce
>>>>>>>
>>>>>>>
>>>>>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>>>>>>
>>>>>>>>
>>>>>>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>>>>>>> Do you have some advance?
>>>>>>>> Salutations, thanks.
>>>>>>>> Pablo.
>>>>>>>>
>>>>>>>>
>>>>>>>> Jackson, Bruce wrote:
>>>>>>>>>
>>>>>>>>> The Felix site has a useful section on getting things going on Android >>>>>>>> (
>>>>>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html) but
>>>>>>>>> isn't
>>>>>>>>> so clear about embedding the framework into an Android app"
>>>>>>>>>
>>>>>>>>> "Apache Felix can also be integrated with an Android application. To
>>>>>>>>> achieve
>>>>>>>>> this, you need to embed Felix into onCreate() method of your Activity
>>>>>>>>> class
>>>>>>>>> (see Android docs for more details on how to use an Activity) and
>>>>>>>>> process
>>>>>>>>> your bundles as shown above."
>>>>>>>>>
>>>>>>>>> Has anyone got an example of how you do this? I understand how to write
>>>>>>>>> the
>>>>>>>>> Android app, and I get the point being made here. What I need to
>>>>>>>>> understand
>>>>>>>>> is:
>>>>>>>>>
>>>>>>>>> 1. How do you launch the Felix framework. What do I need to
>>>>>>>>> instantiate?
>>>>>>>>> 2. Where does the framework get its boot configuration (i.e. what
>>>>>>>>> bundles
>>>>>>>>> to
>>>>>>>>> load, run levels, environment variables, etc) from in this case?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>
>



-- 
Karl Pauls
karlpauls@gmail.com

Re: Felix on Android

Posted by Marcel Offermans <ma...@luminis.nl>.
On Feb 15, 2010, at 16:52 , Jackson, Bruce wrote:

> What other bundles do you have installed when running this?

> but I still find that the HTTP service 1.0 complains that:
> 
> org.osgi.framework.BundleException: Unresolved constraint in bundle org.apache.felix.http.jetty [7]: package; (&(package=org.osgi.service.http)(version>=1.2.0))

That's the API that is part of the OSGi compendium. There is a bundle with all the compendium API's available. I'd try that one.

Greetings, Marcel


Re: Felix on Android

Posted by "Jackson, Bruce" <br...@qualcomm.com>.
Great, thanks Karl.


On 22/02/2010 12:04, "Karl Pauls" <ka...@gmail.com> wrote:

> That was just the plain android adb logcat output. It works even if
> you start your own vm.
> 
> regards,
> 
> Karl
> 
> On Mon, Feb 22, 2010 at 12:09 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>> When I was discussing with Karl the other day, he provided me with the debug
>> output below showing the classloading behaviour. Does anyone know if this
>> came from Felix or Dalvik debug tools, and whether I can see the
>> classloading behavior in Felix?
>> 
>> 
>> On 17/02/2010 16:49, "Karl Pauls" <ka...@gmail.com> wrote:
>> 
>>> As I said, it will only happen if you have the importing classes and
>>> the exporting classes dexed into the same classes.dex. In your jdom
>>> case that should not happen as the embedded jar will have it's own
>>> classes.dex so that the "root" classes.dex of your bundle is different
>>> from the embedded one (again, that is the hack you can use to work
>>> around this issue in general).
>>> 
>>> regards,
>>> 
>>> Karl
>>> 
>>> On Wed, Feb 17, 2010 at 5:32 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>>>> Hi Karl
>>>> 
>>>> That's great, thanks! I've got it working too now. Obviously the
>>>> classloading mechanism in Dalvik is different to a regular jvm, as you
>>>> don't
>>>> see this problem in Felix on the JVM.
>>>> 
>>>> Is this likely to cause a similar problem in bundles which have been built
>>>> with an embedded jar (imagine I place something like jdom into a bundle)
>>>> and
>>>> the framework also has a jdom bundle installed?
>>>> 
>>>> Thanks again
>>>> 
>>>> Bruce
>>>> 
>>>> On 16/02/2010 23:40, "Karl Pauls" <ka...@gmail.com> wrote:
>>>> 
>>>>> Wait, i got it working (i.e., i get to the point where your example
>>>>> fails). The reason is this:
>>>>> 
>>>>> W/dalvikvm(  326): Class resolved by unexpected DEX:
>>>>> Lorg/mortbay/jetty/servlet/ServletHandler$Context;(0x400a0288):0x68578
>>>>> ref [Ljavax/servlet/ServletContext;]
>>>>> Ljavax/servlet/ServletContext;(0x4002eec0):0x5ef48
>>>>> W/dalvikvm(  326): (Lorg/mortbay/jetty/servlet/ServletHandler$Context;
>>>>> had used a different Ljavax/servlet/ServletContext; during
>>>>> pre-verification)
>>>>> I/dalvikvm(  326): Failed resolving
>>>>> Lorg/mortbay/jetty/servlet/ServletHandler$Context; interface 195
>>>>> 'Ljavax/servlet/ServletContext;'
>>>>> W/dalvikvm(  326): Link of class
>>>>> 'Lorg/mortbay/jetty/servlet/ServletHandler$Context;' failed
>>>>> E/dalvikvm(  326): ERROR: defineClass(0x400a0288,
>>>>> org.mortbay.jetty.servlet.ServletHandler$Context, 0x401d6268, 0, 6067,
>>>>> 0x401b4b28)
>>>>> 
>>>>> The problem is as follows: the http jetty bundle contains its own
>>>>> version of the javax.servlet packages. When you are dexing that
>>>>> bundle. You are including this version inside the classes.dex. Now, in
>>>>> your set-up, you are importing them at runtime from the javax.servlet
>>>>> bundle. That causes the above problem (as the dex is already bound).
>>>>> If you uninstall the javax.servlet bundle (and change the import
>>>>> version constraint inside your test bundle for the javax.servlet*
>>>>> packages to be 2.3.0 instead of 2.4.0 - in which case it will resolve
>>>>> to the http bundle). Then it works:
>>>>> 
>>>>> -> ps
>>>>> START LEVEL 1
>>>>>    ID   State         Level  Name
>>>>> [   0] [Active     ] [    0] System Bundle (2.0.3)
>>>>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
>>>>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
>>>>> [   5] [Active     ] [    1] Apache Felix Log Service (1.0.0)
>>>>> [   6] [Active     ] [    1] HTTP Service (0.8.0.SNAPSHOT)
>>>>> [   7] [Active     ] [    1] Apache Felix Configuration Admin Service
>>>>> (1.2.4)
>>>>> [  10] [Installed  ] [    1] Httptest (1.0.0.201002151713)
>>>>> -> start 10
>>>>> Feb 16, 2010 11:29:22 PM java.io.BufferedWriter <init>
>>>>> INFO: Default buffer size used in BufferedWriter constructor. It would
>>>>> be better to be explicit if an 8k-char buffer is required.
>>>>> DEBUG: WIRE: 10.0 -> javax.servlet -> 6.0
>>>>> DEBUG: WIRE: 10.0 -> org.osgi.service.http -> 6.0
>>>>> DEBUG: WIRE: 10.0 -> org.osgi.framework -> 0
>>>>> DEBUG: WIRE: 10.0 -> javax.servlet.http -> 6.0
>>>>> DEBUG: javax/servlet/http/LocalStrings_en_US.properties
>>>>> DEBUG: javax/servlet/http/LocalStrings_en.properties
>>>>> DEBUG: org/mortbay/http/mime_en_US.properties
>>>>> DEBUG: org/mortbay/http/mime_en.properties
>>>>> DEBUG: org/mortbay/http/encoding_en_US.properties
>>>>> DEBUG: org/mortbay/http/encoding_en.properties
>>>>> 23:29:23.644 EVENT  Started ServletHttpContext[/]
>>>>> 
>>>>> The point is this: if you are dexing a bunch of classes, they will
>>>>> already know about each other and then can't be imported from some
>>>>> place else. The workaround in this case would be to remove the
>>>>> javax.servlet* packages from the http bundle in the first place or (in
>>>>> case you need the optionality) make them a separate jar, dex it, and
>>>>> put it on the bundleclasspath of the http bundle (this way, the rest
>>>>> of the http bundle classes are not dexed together with the imported
>>>>> javax.servlet classes in the same dex).
>>>>> 
>>>>> No bug in felix or a problem with the complier level. Its just one of
>>>>> the points where dalvik is working differently than java... sorry,
>>>>> nothing i can do about that. You will need to be careful when you are
>>>>> dexing bundles to not dex classes inside the bundle that can be
>>>>> substituted by an import together with the other classes of the bundle
>>>>> (either remove them or create a dexed jar on the bundleclasspath for
>>>>> these classes).
>>>>> 
>>>>> regards,
>>>>> 
>>>>> Karl
>>>>> 
>>>>> On Tue, Feb 16, 2010 at 4:37 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>> wrote:
>>>>>> Hi Karl
>>>>>> 
>>>>>> I just tried that, and it makes no difference.
>>>>>> I'll mail you the bundles as discussed in a couple of minutes.
>>>>>> 
>>>>>> Thanks
>>>>>> 
>>>>>> Bruce
>>>>>> 
>>>>>> 
>>>>>> On 16/02/2010 15:33, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>>> 
>>>>>>> Btw. can you first try to set the following property:
>>>>>>> 
>>>>>>> org.osgi.framework.bundle.parent=framework
>>>>>>> 
>>>>>>> and see whether that makes a difference on android?
>>>>>>> 
>>>>>>> regards,
>>>>>>> 
>>>>>>> Karl
>>>>>>> 
>>>>>>> On Tue, Feb 16, 2010 at 2:11 PM, Karl Pauls <ka...@gmail.com> wrote:
>>>>>>>> Yeah, if you could zip your project and send it to me in private mail
>>>>>>>> (list probably wont accept it) - that would be a good start.
>>>>>>>> 
>>>>>>>> regards,
>>>>>>>> 
>>>>>>>> Karl
>>>>>>>> 
>>>>>>>> On Tue, Feb 16, 2010 at 1:53 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>>>>> wrote:
>>>>>>>>> Thanks Karl. Would it help if I zipped the jetty and test bundle I'm
>>>>>>>>> using?
>>>>>>>>> 
>>>>>>>>> Thanks
>>>>>>>>> 
>>>>>>>>> Bruce
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> On 16/02/2010 12:51, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>>>>>> 
>>>>>>>>>> I'll try to look into it tonight.
>>>>>>>>>> 
>>>>>>>>>> regards,
>>>>>>>>>> 
>>>>>>>>>> Karl
>>>>>>>>>> 
>>>>>>>>>> On Tue, Feb 16, 2010 at 12:54 PM, Jackson, Bruce
>>>>>>>>>> <br...@qualcomm.com>
>>>>>>>>>> wrote:
>>>>>>>>>>> Further to this, I have explored the problem some more. Using the
>>>>>>>>>>> dedexer
>>>>>>>>>>> tool (http://dedexer.sourceforge.net/) I can examine the classes
>>>>>>>>>>> that
>>>>>>>>>>> have
>>>>>>>>>>> been put into the classes.dex in the Jetty Http service bundle. I
>>>>>>>>>>> can
>>>>>>>>>>> see
>>>>>>>>>>> in
>>>>>>>>>>> the bundle that I do indeed have the required classes in the dex
>>>>>>>>>>> file:
>>>>>>>>>>> 
>>>>>>>>>>> Processing org/mortbay/jetty/servlet/ServletHandler
>>>>>>>>>>> Processing org/mortbay/jetty/servlet/ServletHolder$Config
>>>>>>>>>>> Processing org/mortbay/jetty/servlet/OsgiServletHttpContext
>>>>>>>>>>> Processing org/mortbay/jetty/servlet/ServletHandler$Context
>>>>>>>>>>> 
>>>>>>>>>>> This is a mystery. Any ideas anyone?
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> On 16/02/2010 10:12, "Bruce Jackson" <br...@qualcomm.com> wrote:
>>>>>>>>>>> 
>>>>>>>>>>>> org.mortbay.jetty.servlet.ServletHandler
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> --
>>>>>>>> Karl Pauls
>>>>>>>> karlpauls@gmail.com
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 


Re: Felix on Android

Posted by Karl Pauls <ka...@gmail.com>.
That was just the plain android adb logcat output. It works even if
you start your own vm.

regards,

Karl

On Mon, Feb 22, 2010 at 12:09 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
> When I was discussing with Karl the other day, he provided me with the debug
> output below showing the classloading behaviour. Does anyone know if this
> came from Felix or Dalvik debug tools, and whether I can see the
> classloading behavior in Felix?
>
>
> On 17/02/2010 16:49, "Karl Pauls" <ka...@gmail.com> wrote:
>
>> As I said, it will only happen if you have the importing classes and
>> the exporting classes dexed into the same classes.dex. In your jdom
>> case that should not happen as the embedded jar will have it's own
>> classes.dex so that the "root" classes.dex of your bundle is different
>> from the embedded one (again, that is the hack you can use to work
>> around this issue in general).
>>
>> regards,
>>
>> Karl
>>
>> On Wed, Feb 17, 2010 at 5:32 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>>> Hi Karl
>>>
>>> That's great, thanks! I've got it working too now. Obviously the
>>> classloading mechanism in Dalvik is different to a regular jvm, as you don't
>>> see this problem in Felix on the JVM.
>>>
>>> Is this likely to cause a similar problem in bundles which have been built
>>> with an embedded jar (imagine I place something like jdom into a bundle) and
>>> the framework also has a jdom bundle installed?
>>>
>>> Thanks again
>>>
>>> Bruce
>>>
>>> On 16/02/2010 23:40, "Karl Pauls" <ka...@gmail.com> wrote:
>>>
>>>> Wait, i got it working (i.e., i get to the point where your example
>>>> fails). The reason is this:
>>>>
>>>> W/dalvikvm(  326): Class resolved by unexpected DEX:
>>>> Lorg/mortbay/jetty/servlet/ServletHandler$Context;(0x400a0288):0x68578
>>>> ref [Ljavax/servlet/ServletContext;]
>>>> Ljavax/servlet/ServletContext;(0x4002eec0):0x5ef48
>>>> W/dalvikvm(  326): (Lorg/mortbay/jetty/servlet/ServletHandler$Context;
>>>> had used a different Ljavax/servlet/ServletContext; during
>>>> pre-verification)
>>>> I/dalvikvm(  326): Failed resolving
>>>> Lorg/mortbay/jetty/servlet/ServletHandler$Context; interface 195
>>>> 'Ljavax/servlet/ServletContext;'
>>>> W/dalvikvm(  326): Link of class
>>>> 'Lorg/mortbay/jetty/servlet/ServletHandler$Context;' failed
>>>> E/dalvikvm(  326): ERROR: defineClass(0x400a0288,
>>>> org.mortbay.jetty.servlet.ServletHandler$Context, 0x401d6268, 0, 6067,
>>>> 0x401b4b28)
>>>>
>>>> The problem is as follows: the http jetty bundle contains its own
>>>> version of the javax.servlet packages. When you are dexing that
>>>> bundle. You are including this version inside the classes.dex. Now, in
>>>> your set-up, you are importing them at runtime from the javax.servlet
>>>> bundle. That causes the above problem (as the dex is already bound).
>>>> If you uninstall the javax.servlet bundle (and change the import
>>>> version constraint inside your test bundle for the javax.servlet*
>>>> packages to be 2.3.0 instead of 2.4.0 - in which case it will resolve
>>>> to the http bundle). Then it works:
>>>>
>>>> -> ps
>>>> START LEVEL 1
>>>>    ID   State         Level  Name
>>>> [   0] [Active     ] [    0] System Bundle (2.0.3)
>>>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
>>>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
>>>> [   5] [Active     ] [    1] Apache Felix Log Service (1.0.0)
>>>> [   6] [Active     ] [    1] HTTP Service (0.8.0.SNAPSHOT)
>>>> [   7] [Active     ] [    1] Apache Felix Configuration Admin Service
>>>> (1.2.4)
>>>> [  10] [Installed  ] [    1] Httptest (1.0.0.201002151713)
>>>> -> start 10
>>>> Feb 16, 2010 11:29:22 PM java.io.BufferedWriter <init>
>>>> INFO: Default buffer size used in BufferedWriter constructor. It would
>>>> be better to be explicit if an 8k-char buffer is required.
>>>> DEBUG: WIRE: 10.0 -> javax.servlet -> 6.0
>>>> DEBUG: WIRE: 10.0 -> org.osgi.service.http -> 6.0
>>>> DEBUG: WIRE: 10.0 -> org.osgi.framework -> 0
>>>> DEBUG: WIRE: 10.0 -> javax.servlet.http -> 6.0
>>>> DEBUG: javax/servlet/http/LocalStrings_en_US.properties
>>>> DEBUG: javax/servlet/http/LocalStrings_en.properties
>>>> DEBUG: org/mortbay/http/mime_en_US.properties
>>>> DEBUG: org/mortbay/http/mime_en.properties
>>>> DEBUG: org/mortbay/http/encoding_en_US.properties
>>>> DEBUG: org/mortbay/http/encoding_en.properties
>>>> 23:29:23.644 EVENT  Started ServletHttpContext[/]
>>>>
>>>> The point is this: if you are dexing a bunch of classes, they will
>>>> already know about each other and then can't be imported from some
>>>> place else. The workaround in this case would be to remove the
>>>> javax.servlet* packages from the http bundle in the first place or (in
>>>> case you need the optionality) make them a separate jar, dex it, and
>>>> put it on the bundleclasspath of the http bundle (this way, the rest
>>>> of the http bundle classes are not dexed together with the imported
>>>> javax.servlet classes in the same dex).
>>>>
>>>> No bug in felix or a problem with the complier level. Its just one of
>>>> the points where dalvik is working differently than java... sorry,
>>>> nothing i can do about that. You will need to be careful when you are
>>>> dexing bundles to not dex classes inside the bundle that can be
>>>> substituted by an import together with the other classes of the bundle
>>>> (either remove them or create a dexed jar on the bundleclasspath for
>>>> these classes).
>>>>
>>>> regards,
>>>>
>>>> Karl
>>>>
>>>> On Tue, Feb 16, 2010 at 4:37 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>>>>> Hi Karl
>>>>>
>>>>> I just tried that, and it makes no difference.
>>>>> I'll mail you the bundles as discussed in a couple of minutes.
>>>>>
>>>>> Thanks
>>>>>
>>>>> Bruce
>>>>>
>>>>>
>>>>> On 16/02/2010 15:33, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>>
>>>>>> Btw. can you first try to set the following property:
>>>>>>
>>>>>> org.osgi.framework.bundle.parent=framework
>>>>>>
>>>>>> and see whether that makes a difference on android?
>>>>>>
>>>>>> regards,
>>>>>>
>>>>>> Karl
>>>>>>
>>>>>> On Tue, Feb 16, 2010 at 2:11 PM, Karl Pauls <ka...@gmail.com> wrote:
>>>>>>> Yeah, if you could zip your project and send it to me in private mail
>>>>>>> (list probably wont accept it) - that would be a good start.
>>>>>>>
>>>>>>> regards,
>>>>>>>
>>>>>>> Karl
>>>>>>>
>>>>>>> On Tue, Feb 16, 2010 at 1:53 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>>>> wrote:
>>>>>>>> Thanks Karl. Would it help if I zipped the jetty and test bundle I'm
>>>>>>>> using?
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>>
>>>>>>>> Bruce
>>>>>>>>
>>>>>>>>
>>>>>>>> On 16/02/2010 12:51, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> I'll try to look into it tonight.
>>>>>>>>>
>>>>>>>>> regards,
>>>>>>>>>
>>>>>>>>> Karl
>>>>>>>>>
>>>>>>>>> On Tue, Feb 16, 2010 at 12:54 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>>>>>> wrote:
>>>>>>>>>> Further to this, I have explored the problem some more. Using the
>>>>>>>>>> dedexer
>>>>>>>>>> tool (http://dedexer.sourceforge.net/) I can examine the classes that
>>>>>>>>>> have
>>>>>>>>>> been put into the classes.dex in the Jetty Http service bundle. I can
>>>>>>>>>> see
>>>>>>>>>> in
>>>>>>>>>> the bundle that I do indeed have the required classes in the dex file:
>>>>>>>>>>
>>>>>>>>>> Processing org/mortbay/jetty/servlet/ServletHandler
>>>>>>>>>> Processing org/mortbay/jetty/servlet/ServletHolder$Config
>>>>>>>>>> Processing org/mortbay/jetty/servlet/OsgiServletHttpContext
>>>>>>>>>> Processing org/mortbay/jetty/servlet/ServletHandler$Context
>>>>>>>>>>
>>>>>>>>>> This is a mystery. Any ideas anyone?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 16/02/2010 10:12, "Bruce Jackson" <br...@qualcomm.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> org.mortbay.jetty.servlet.ServletHandler
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Karl Pauls
>>>>>>> karlpauls@gmail.com
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



-- 
Karl Pauls
karlpauls@gmail.com

Re: Felix on Android

Posted by "Jackson, Bruce" <br...@qualcomm.com>.
When I was discussing with Karl the other day, he provided me with the debug
output below showing the classloading behaviour. Does anyone know if this
came from Felix or Dalvik debug tools, and whether I can see the
classloading behavior in Felix?


On 17/02/2010 16:49, "Karl Pauls" <ka...@gmail.com> wrote:

> As I said, it will only happen if you have the importing classes and
> the exporting classes dexed into the same classes.dex. In your jdom
> case that should not happen as the embedded jar will have it's own
> classes.dex so that the "root" classes.dex of your bundle is different
> from the embedded one (again, that is the hack you can use to work
> around this issue in general).
> 
> regards,
> 
> Karl
> 
> On Wed, Feb 17, 2010 at 5:32 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>> Hi Karl
>> 
>> That's great, thanks! I've got it working too now. Obviously the
>> classloading mechanism in Dalvik is different to a regular jvm, as you don't
>> see this problem in Felix on the JVM.
>> 
>> Is this likely to cause a similar problem in bundles which have been built
>> with an embedded jar (imagine I place something like jdom into a bundle) and
>> the framework also has a jdom bundle installed?
>> 
>> Thanks again
>> 
>> Bruce
>> 
>> On 16/02/2010 23:40, "Karl Pauls" <ka...@gmail.com> wrote:
>> 
>>> Wait, i got it working (i.e., i get to the point where your example
>>> fails). The reason is this:
>>> 
>>> W/dalvikvm(  326): Class resolved by unexpected DEX:
>>> Lorg/mortbay/jetty/servlet/ServletHandler$Context;(0x400a0288):0x68578
>>> ref [Ljavax/servlet/ServletContext;]
>>> Ljavax/servlet/ServletContext;(0x4002eec0):0x5ef48
>>> W/dalvikvm(  326): (Lorg/mortbay/jetty/servlet/ServletHandler$Context;
>>> had used a different Ljavax/servlet/ServletContext; during
>>> pre-verification)
>>> I/dalvikvm(  326): Failed resolving
>>> Lorg/mortbay/jetty/servlet/ServletHandler$Context; interface 195
>>> 'Ljavax/servlet/ServletContext;'
>>> W/dalvikvm(  326): Link of class
>>> 'Lorg/mortbay/jetty/servlet/ServletHandler$Context;' failed
>>> E/dalvikvm(  326): ERROR: defineClass(0x400a0288,
>>> org.mortbay.jetty.servlet.ServletHandler$Context, 0x401d6268, 0, 6067,
>>> 0x401b4b28)
>>> 
>>> The problem is as follows: the http jetty bundle contains its own
>>> version of the javax.servlet packages. When you are dexing that
>>> bundle. You are including this version inside the classes.dex. Now, in
>>> your set-up, you are importing them at runtime from the javax.servlet
>>> bundle. That causes the above problem (as the dex is already bound).
>>> If you uninstall the javax.servlet bundle (and change the import
>>> version constraint inside your test bundle for the javax.servlet*
>>> packages to be 2.3.0 instead of 2.4.0 - in which case it will resolve
>>> to the http bundle). Then it works:
>>> 
>>> -> ps
>>> START LEVEL 1
>>>    ID   State         Level  Name
>>> [   0] [Active     ] [    0] System Bundle (2.0.3)
>>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
>>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
>>> [   5] [Active     ] [    1] Apache Felix Log Service (1.0.0)
>>> [   6] [Active     ] [    1] HTTP Service (0.8.0.SNAPSHOT)
>>> [   7] [Active     ] [    1] Apache Felix Configuration Admin Service
>>> (1.2.4)
>>> [  10] [Installed  ] [    1] Httptest (1.0.0.201002151713)
>>> -> start 10
>>> Feb 16, 2010 11:29:22 PM java.io.BufferedWriter <init>
>>> INFO: Default buffer size used in BufferedWriter constructor. It would
>>> be better to be explicit if an 8k-char buffer is required.
>>> DEBUG: WIRE: 10.0 -> javax.servlet -> 6.0
>>> DEBUG: WIRE: 10.0 -> org.osgi.service.http -> 6.0
>>> DEBUG: WIRE: 10.0 -> org.osgi.framework -> 0
>>> DEBUG: WIRE: 10.0 -> javax.servlet.http -> 6.0
>>> DEBUG: javax/servlet/http/LocalStrings_en_US.properties
>>> DEBUG: javax/servlet/http/LocalStrings_en.properties
>>> DEBUG: org/mortbay/http/mime_en_US.properties
>>> DEBUG: org/mortbay/http/mime_en.properties
>>> DEBUG: org/mortbay/http/encoding_en_US.properties
>>> DEBUG: org/mortbay/http/encoding_en.properties
>>> 23:29:23.644 EVENT  Started ServletHttpContext[/]
>>> 
>>> The point is this: if you are dexing a bunch of classes, they will
>>> already know about each other and then can't be imported from some
>>> place else. The workaround in this case would be to remove the
>>> javax.servlet* packages from the http bundle in the first place or (in
>>> case you need the optionality) make them a separate jar, dex it, and
>>> put it on the bundleclasspath of the http bundle (this way, the rest
>>> of the http bundle classes are not dexed together with the imported
>>> javax.servlet classes in the same dex).
>>> 
>>> No bug in felix or a problem with the complier level. Its just one of
>>> the points where dalvik is working differently than java... sorry,
>>> nothing i can do about that. You will need to be careful when you are
>>> dexing bundles to not dex classes inside the bundle that can be
>>> substituted by an import together with the other classes of the bundle
>>> (either remove them or create a dexed jar on the bundleclasspath for
>>> these classes).
>>> 
>>> regards,
>>> 
>>> Karl
>>> 
>>> On Tue, Feb 16, 2010 at 4:37 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>>>> Hi Karl
>>>> 
>>>> I just tried that, and it makes no difference.
>>>> I'll mail you the bundles as discussed in a couple of minutes.
>>>> 
>>>> Thanks
>>>> 
>>>> Bruce
>>>> 
>>>> 
>>>> On 16/02/2010 15:33, "Karl Pauls" <ka...@gmail.com> wrote:
>>>> 
>>>>> Btw. can you first try to set the following property:
>>>>> 
>>>>> org.osgi.framework.bundle.parent=framework
>>>>> 
>>>>> and see whether that makes a difference on android?
>>>>> 
>>>>> regards,
>>>>> 
>>>>> Karl
>>>>> 
>>>>> On Tue, Feb 16, 2010 at 2:11 PM, Karl Pauls <ka...@gmail.com> wrote:
>>>>>> Yeah, if you could zip your project and send it to me in private mail
>>>>>> (list probably wont accept it) - that would be a good start.
>>>>>> 
>>>>>> regards,
>>>>>> 
>>>>>> Karl
>>>>>> 
>>>>>> On Tue, Feb 16, 2010 at 1:53 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>>> wrote:
>>>>>>> Thanks Karl. Would it help if I zipped the jetty and test bundle I'm
>>>>>>> using?
>>>>>>> 
>>>>>>> Thanks
>>>>>>> 
>>>>>>> Bruce
>>>>>>> 
>>>>>>> 
>>>>>>> On 16/02/2010 12:51, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>>>> 
>>>>>>>> I'll try to look into it tonight.
>>>>>>>> 
>>>>>>>> regards,
>>>>>>>> 
>>>>>>>> Karl
>>>>>>>> 
>>>>>>>> On Tue, Feb 16, 2010 at 12:54 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>>>>> wrote:
>>>>>>>>> Further to this, I have explored the problem some more. Using the
>>>>>>>>> dedexer
>>>>>>>>> tool (http://dedexer.sourceforge.net/) I can examine the classes that
>>>>>>>>> have
>>>>>>>>> been put into the classes.dex in the Jetty Http service bundle. I can
>>>>>>>>> see
>>>>>>>>> in
>>>>>>>>> the bundle that I do indeed have the required classes in the dex file:
>>>>>>>>> 
>>>>>>>>> Processing org/mortbay/jetty/servlet/ServletHandler
>>>>>>>>> Processing org/mortbay/jetty/servlet/ServletHolder$Config
>>>>>>>>> Processing org/mortbay/jetty/servlet/OsgiServletHttpContext
>>>>>>>>> Processing org/mortbay/jetty/servlet/ServletHandler$Context
>>>>>>>>> 
>>>>>>>>> This is a mystery. Any ideas anyone?
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> On 16/02/2010 10:12, "Bruce Jackson" <br...@qualcomm.com> wrote:
>>>>>>>>> 
>>>>>>>>>> org.mortbay.jetty.servlet.ServletHandler
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> --
>>>>>> Karl Pauls
>>>>>> karlpauls@gmail.com
>>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 


Re: Felix on Android

Posted by Karl Pauls <ka...@gmail.com>.
As I said, it will only happen if you have the importing classes and
the exporting classes dexed into the same classes.dex. In your jdom
case that should not happen as the embedded jar will have it's own
classes.dex so that the "root" classes.dex of your bundle is different
from the embedded one (again, that is the hack you can use to work
around this issue in general).

regards,

Karl

On Wed, Feb 17, 2010 at 5:32 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
> Hi Karl
>
> That's great, thanks! I've got it working too now. Obviously the
> classloading mechanism in Dalvik is different to a regular jvm, as you don't
> see this problem in Felix on the JVM.
>
> Is this likely to cause a similar problem in bundles which have been built
> with an embedded jar (imagine I place something like jdom into a bundle) and
> the framework also has a jdom bundle installed?
>
> Thanks again
>
> Bruce
>
> On 16/02/2010 23:40, "Karl Pauls" <ka...@gmail.com> wrote:
>
>> Wait, i got it working (i.e., i get to the point where your example
>> fails). The reason is this:
>>
>> W/dalvikvm(  326): Class resolved by unexpected DEX:
>> Lorg/mortbay/jetty/servlet/ServletHandler$Context;(0x400a0288):0x68578
>> ref [Ljavax/servlet/ServletContext;]
>> Ljavax/servlet/ServletContext;(0x4002eec0):0x5ef48
>> W/dalvikvm(  326): (Lorg/mortbay/jetty/servlet/ServletHandler$Context;
>> had used a different Ljavax/servlet/ServletContext; during
>> pre-verification)
>> I/dalvikvm(  326): Failed resolving
>> Lorg/mortbay/jetty/servlet/ServletHandler$Context; interface 195
>> 'Ljavax/servlet/ServletContext;'
>> W/dalvikvm(  326): Link of class
>> 'Lorg/mortbay/jetty/servlet/ServletHandler$Context;' failed
>> E/dalvikvm(  326): ERROR: defineClass(0x400a0288,
>> org.mortbay.jetty.servlet.ServletHandler$Context, 0x401d6268, 0, 6067,
>> 0x401b4b28)
>>
>> The problem is as follows: the http jetty bundle contains its own
>> version of the javax.servlet packages. When you are dexing that
>> bundle. You are including this version inside the classes.dex. Now, in
>> your set-up, you are importing them at runtime from the javax.servlet
>> bundle. That causes the above problem (as the dex is already bound).
>> If you uninstall the javax.servlet bundle (and change the import
>> version constraint inside your test bundle for the javax.servlet*
>> packages to be 2.3.0 instead of 2.4.0 - in which case it will resolve
>> to the http bundle). Then it works:
>>
>> -> ps
>> START LEVEL 1
>>    ID   State         Level  Name
>> [   0] [Active     ] [    0] System Bundle (2.0.3)
>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
>> [   5] [Active     ] [    1] Apache Felix Log Service (1.0.0)
>> [   6] [Active     ] [    1] HTTP Service (0.8.0.SNAPSHOT)
>> [   7] [Active     ] [    1] Apache Felix Configuration Admin Service (1.2.4)
>> [  10] [Installed  ] [    1] Httptest (1.0.0.201002151713)
>> -> start 10
>> Feb 16, 2010 11:29:22 PM java.io.BufferedWriter <init>
>> INFO: Default buffer size used in BufferedWriter constructor. It would
>> be better to be explicit if an 8k-char buffer is required.
>> DEBUG: WIRE: 10.0 -> javax.servlet -> 6.0
>> DEBUG: WIRE: 10.0 -> org.osgi.service.http -> 6.0
>> DEBUG: WIRE: 10.0 -> org.osgi.framework -> 0
>> DEBUG: WIRE: 10.0 -> javax.servlet.http -> 6.0
>> DEBUG: javax/servlet/http/LocalStrings_en_US.properties
>> DEBUG: javax/servlet/http/LocalStrings_en.properties
>> DEBUG: org/mortbay/http/mime_en_US.properties
>> DEBUG: org/mortbay/http/mime_en.properties
>> DEBUG: org/mortbay/http/encoding_en_US.properties
>> DEBUG: org/mortbay/http/encoding_en.properties
>> 23:29:23.644 EVENT  Started ServletHttpContext[/]
>>
>> The point is this: if you are dexing a bunch of classes, they will
>> already know about each other and then can't be imported from some
>> place else. The workaround in this case would be to remove the
>> javax.servlet* packages from the http bundle in the first place or (in
>> case you need the optionality) make them a separate jar, dex it, and
>> put it on the bundleclasspath of the http bundle (this way, the rest
>> of the http bundle classes are not dexed together with the imported
>> javax.servlet classes in the same dex).
>>
>> No bug in felix or a problem with the complier level. Its just one of
>> the points where dalvik is working differently than java... sorry,
>> nothing i can do about that. You will need to be careful when you are
>> dexing bundles to not dex classes inside the bundle that can be
>> substituted by an import together with the other classes of the bundle
>> (either remove them or create a dexed jar on the bundleclasspath for
>> these classes).
>>
>> regards,
>>
>> Karl
>>
>> On Tue, Feb 16, 2010 at 4:37 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>>> Hi Karl
>>>
>>> I just tried that, and it makes no difference.
>>> I'll mail you the bundles as discussed in a couple of minutes.
>>>
>>> Thanks
>>>
>>> Bruce
>>>
>>>
>>> On 16/02/2010 15:33, "Karl Pauls" <ka...@gmail.com> wrote:
>>>
>>>> Btw. can you first try to set the following property:
>>>>
>>>> org.osgi.framework.bundle.parent=framework
>>>>
>>>> and see whether that makes a difference on android?
>>>>
>>>> regards,
>>>>
>>>> Karl
>>>>
>>>> On Tue, Feb 16, 2010 at 2:11 PM, Karl Pauls <ka...@gmail.com> wrote:
>>>>> Yeah, if you could zip your project and send it to me in private mail
>>>>> (list probably wont accept it) - that would be a good start.
>>>>>
>>>>> regards,
>>>>>
>>>>> Karl
>>>>>
>>>>> On Tue, Feb 16, 2010 at 1:53 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>> wrote:
>>>>>> Thanks Karl. Would it help if I zipped the jetty and test bundle I'm
>>>>>> using?
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Bruce
>>>>>>
>>>>>>
>>>>>> On 16/02/2010 12:51, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>>>
>>>>>>> I'll try to look into it tonight.
>>>>>>>
>>>>>>> regards,
>>>>>>>
>>>>>>> Karl
>>>>>>>
>>>>>>> On Tue, Feb 16, 2010 at 12:54 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>>>> wrote:
>>>>>>>> Further to this, I have explored the problem some more. Using the
>>>>>>>> dedexer
>>>>>>>> tool (http://dedexer.sourceforge.net/) I can examine the classes that
>>>>>>>> have
>>>>>>>> been put into the classes.dex in the Jetty Http service bundle. I can
>>>>>>>> see
>>>>>>>> in
>>>>>>>> the bundle that I do indeed have the required classes in the dex file:
>>>>>>>>
>>>>>>>> Processing org/mortbay/jetty/servlet/ServletHandler
>>>>>>>> Processing org/mortbay/jetty/servlet/ServletHolder$Config
>>>>>>>> Processing org/mortbay/jetty/servlet/OsgiServletHttpContext
>>>>>>>> Processing org/mortbay/jetty/servlet/ServletHandler$Context
>>>>>>>>
>>>>>>>> This is a mystery. Any ideas anyone?
>>>>>>>>
>>>>>>>>
>>>>>>>> On 16/02/2010 10:12, "Bruce Jackson" <br...@qualcomm.com> wrote:
>>>>>>>>
>>>>>>>>> org.mortbay.jetty.servlet.ServletHandler
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Karl Pauls
>>>>> karlpauls@gmail.com
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>



-- 
Karl Pauls
karlpauls@gmail.com

Re: Felix on Android

Posted by "Jackson, Bruce" <br...@qualcomm.com>.
Hi Karl

That's great, thanks! I've got it working too now. Obviously the
classloading mechanism in Dalvik is different to a regular jvm, as you don't
see this problem in Felix on the JVM.

Is this likely to cause a similar problem in bundles which have been built
with an embedded jar (imagine I place something like jdom into a bundle) and
the framework also has a jdom bundle installed?

Thanks again

Bruce

On 16/02/2010 23:40, "Karl Pauls" <ka...@gmail.com> wrote:

> Wait, i got it working (i.e., i get to the point where your example
> fails). The reason is this:
> 
> W/dalvikvm(  326): Class resolved by unexpected DEX:
> Lorg/mortbay/jetty/servlet/ServletHandler$Context;(0x400a0288):0x68578
> ref [Ljavax/servlet/ServletContext;]
> Ljavax/servlet/ServletContext;(0x4002eec0):0x5ef48
> W/dalvikvm(  326): (Lorg/mortbay/jetty/servlet/ServletHandler$Context;
> had used a different Ljavax/servlet/ServletContext; during
> pre-verification)
> I/dalvikvm(  326): Failed resolving
> Lorg/mortbay/jetty/servlet/ServletHandler$Context; interface 195
> 'Ljavax/servlet/ServletContext;'
> W/dalvikvm(  326): Link of class
> 'Lorg/mortbay/jetty/servlet/ServletHandler$Context;' failed
> E/dalvikvm(  326): ERROR: defineClass(0x400a0288,
> org.mortbay.jetty.servlet.ServletHandler$Context, 0x401d6268, 0, 6067,
> 0x401b4b28)
> 
> The problem is as follows: the http jetty bundle contains its own
> version of the javax.servlet packages. When you are dexing that
> bundle. You are including this version inside the classes.dex. Now, in
> your set-up, you are importing them at runtime from the javax.servlet
> bundle. That causes the above problem (as the dex is already bound).
> If you uninstall the javax.servlet bundle (and change the import
> version constraint inside your test bundle for the javax.servlet*
> packages to be 2.3.0 instead of 2.4.0 - in which case it will resolve
> to the http bundle). Then it works:
> 
> -> ps
> START LEVEL 1
>    ID   State         Level  Name
> [   0] [Active     ] [    0] System Bundle (2.0.3)
> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
> [   5] [Active     ] [    1] Apache Felix Log Service (1.0.0)
> [   6] [Active     ] [    1] HTTP Service (0.8.0.SNAPSHOT)
> [   7] [Active     ] [    1] Apache Felix Configuration Admin Service (1.2.4)
> [  10] [Installed  ] [    1] Httptest (1.0.0.201002151713)
> -> start 10
> Feb 16, 2010 11:29:22 PM java.io.BufferedWriter <init>
> INFO: Default buffer size used in BufferedWriter constructor. It would
> be better to be explicit if an 8k-char buffer is required.
> DEBUG: WIRE: 10.0 -> javax.servlet -> 6.0
> DEBUG: WIRE: 10.0 -> org.osgi.service.http -> 6.0
> DEBUG: WIRE: 10.0 -> org.osgi.framework -> 0
> DEBUG: WIRE: 10.0 -> javax.servlet.http -> 6.0
> DEBUG: javax/servlet/http/LocalStrings_en_US.properties
> DEBUG: javax/servlet/http/LocalStrings_en.properties
> DEBUG: org/mortbay/http/mime_en_US.properties
> DEBUG: org/mortbay/http/mime_en.properties
> DEBUG: org/mortbay/http/encoding_en_US.properties
> DEBUG: org/mortbay/http/encoding_en.properties
> 23:29:23.644 EVENT  Started ServletHttpContext[/]
> 
> The point is this: if you are dexing a bunch of classes, they will
> already know about each other and then can't be imported from some
> place else. The workaround in this case would be to remove the
> javax.servlet* packages from the http bundle in the first place or (in
> case you need the optionality) make them a separate jar, dex it, and
> put it on the bundleclasspath of the http bundle (this way, the rest
> of the http bundle classes are not dexed together with the imported
> javax.servlet classes in the same dex).
> 
> No bug in felix or a problem with the complier level. Its just one of
> the points where dalvik is working differently than java... sorry,
> nothing i can do about that. You will need to be careful when you are
> dexing bundles to not dex classes inside the bundle that can be
> substituted by an import together with the other classes of the bundle
> (either remove them or create a dexed jar on the bundleclasspath for
> these classes).
> 
> regards,
> 
> Karl
> 
> On Tue, Feb 16, 2010 at 4:37 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>> Hi Karl
>> 
>> I just tried that, and it makes no difference.
>> I'll mail you the bundles as discussed in a couple of minutes.
>> 
>> Thanks
>> 
>> Bruce
>> 
>> 
>> On 16/02/2010 15:33, "Karl Pauls" <ka...@gmail.com> wrote:
>> 
>>> Btw. can you first try to set the following property:
>>> 
>>> org.osgi.framework.bundle.parent=framework
>>> 
>>> and see whether that makes a difference on android?
>>> 
>>> regards,
>>> 
>>> Karl
>>> 
>>> On Tue, Feb 16, 2010 at 2:11 PM, Karl Pauls <ka...@gmail.com> wrote:
>>>> Yeah, if you could zip your project and send it to me in private mail
>>>> (list probably wont accept it) - that would be a good start.
>>>> 
>>>> regards,
>>>> 
>>>> Karl
>>>> 
>>>> On Tue, Feb 16, 2010 at 1:53 PM, Jackson, Bruce <br...@qualcomm.com>
>>>> wrote:
>>>>> Thanks Karl. Would it help if I zipped the jetty and test bundle I'm
>>>>> using?
>>>>> 
>>>>> Thanks
>>>>> 
>>>>> Bruce
>>>>> 
>>>>> 
>>>>> On 16/02/2010 12:51, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>> 
>>>>>> I'll try to look into it tonight.
>>>>>> 
>>>>>> regards,
>>>>>> 
>>>>>> Karl
>>>>>> 
>>>>>> On Tue, Feb 16, 2010 at 12:54 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>>> wrote:
>>>>>>> Further to this, I have explored the problem some more. Using the
>>>>>>> dedexer
>>>>>>> tool (http://dedexer.sourceforge.net/) I can examine the classes that
>>>>>>> have
>>>>>>> been put into the classes.dex in the Jetty Http service bundle. I can
>>>>>>> see
>>>>>>> in
>>>>>>> the bundle that I do indeed have the required classes in the dex file:
>>>>>>> 
>>>>>>> Processing org/mortbay/jetty/servlet/ServletHandler
>>>>>>> Processing org/mortbay/jetty/servlet/ServletHolder$Config
>>>>>>> Processing org/mortbay/jetty/servlet/OsgiServletHttpContext
>>>>>>> Processing org/mortbay/jetty/servlet/ServletHandler$Context
>>>>>>> 
>>>>>>> This is a mystery. Any ideas anyone?
>>>>>>> 
>>>>>>> 
>>>>>>> On 16/02/2010 10:12, "Bruce Jackson" <br...@qualcomm.com> wrote:
>>>>>>> 
>>>>>>>> org.mortbay.jetty.servlet.ServletHandler
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> 
>>>> --
>>>> Karl Pauls
>>>> karlpauls@gmail.com
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 


Re: Felix on Android

Posted by Karl Pauls <ka...@gmail.com>.
Wait, i got it working (i.e., i get to the point where your example
fails). The reason is this:

W/dalvikvm(  326): Class resolved by unexpected DEX:
Lorg/mortbay/jetty/servlet/ServletHandler$Context;(0x400a0288):0x68578
ref [Ljavax/servlet/ServletContext;]
Ljavax/servlet/ServletContext;(0x4002eec0):0x5ef48
W/dalvikvm(  326): (Lorg/mortbay/jetty/servlet/ServletHandler$Context;
had used a different Ljavax/servlet/ServletContext; during
pre-verification)
I/dalvikvm(  326): Failed resolving
Lorg/mortbay/jetty/servlet/ServletHandler$Context; interface 195
'Ljavax/servlet/ServletContext;'
W/dalvikvm(  326): Link of class
'Lorg/mortbay/jetty/servlet/ServletHandler$Context;' failed
E/dalvikvm(  326): ERROR: defineClass(0x400a0288,
org.mortbay.jetty.servlet.ServletHandler$Context, 0x401d6268, 0, 6067,
0x401b4b28)

The problem is as follows: the http jetty bundle contains its own
version of the javax.servlet packages. When you are dexing that
bundle. You are including this version inside the classes.dex. Now, in
your set-up, you are importing them at runtime from the javax.servlet
bundle. That causes the above problem (as the dex is already bound).
If you uninstall the javax.servlet bundle (and change the import
version constraint inside your test bundle for the javax.servlet*
packages to be 2.3.0 instead of 2.4.0 - in which case it will resolve
to the http bundle). Then it works:

-> ps
START LEVEL 1
   ID   State         Level  Name
[   0] [Active     ] [    0] System Bundle (2.0.3)
[   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
[   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
[   5] [Active     ] [    1] Apache Felix Log Service (1.0.0)
[   6] [Active     ] [    1] HTTP Service (0.8.0.SNAPSHOT)
[   7] [Active     ] [    1] Apache Felix Configuration Admin Service (1.2.4)
[  10] [Installed  ] [    1] Httptest (1.0.0.201002151713)
-> start 10
Feb 16, 2010 11:29:22 PM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would
be better to be explicit if an 8k-char buffer is required.
DEBUG: WIRE: 10.0 -> javax.servlet -> 6.0
DEBUG: WIRE: 10.0 -> org.osgi.service.http -> 6.0
DEBUG: WIRE: 10.0 -> org.osgi.framework -> 0
DEBUG: WIRE: 10.0 -> javax.servlet.http -> 6.0
DEBUG: javax/servlet/http/LocalStrings_en_US.properties
DEBUG: javax/servlet/http/LocalStrings_en.properties
DEBUG: org/mortbay/http/mime_en_US.properties
DEBUG: org/mortbay/http/mime_en.properties
DEBUG: org/mortbay/http/encoding_en_US.properties
DEBUG: org/mortbay/http/encoding_en.properties
23:29:23.644 EVENT  Started ServletHttpContext[/]

The point is this: if you are dexing a bunch of classes, they will
already know about each other and then can't be imported from some
place else. The workaround in this case would be to remove the
javax.servlet* packages from the http bundle in the first place or (in
case you need the optionality) make them a separate jar, dex it, and
put it on the bundleclasspath of the http bundle (this way, the rest
of the http bundle classes are not dexed together with the imported
javax.servlet classes in the same dex).

No bug in felix or a problem with the complier level. Its just one of
the points where dalvik is working differently than java... sorry,
nothing i can do about that. You will need to be careful when you are
dexing bundles to not dex classes inside the bundle that can be
substituted by an import together with the other classes of the bundle
(either remove them or create a dexed jar on the bundleclasspath for
these classes).

regards,

Karl

On Tue, Feb 16, 2010 at 4:37 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
> Hi Karl
>
> I just tried that, and it makes no difference.
> I'll mail you the bundles as discussed in a couple of minutes.
>
> Thanks
>
> Bruce
>
>
> On 16/02/2010 15:33, "Karl Pauls" <ka...@gmail.com> wrote:
>
>> Btw. can you first try to set the following property:
>>
>> org.osgi.framework.bundle.parent=framework
>>
>> and see whether that makes a difference on android?
>>
>> regards,
>>
>> Karl
>>
>> On Tue, Feb 16, 2010 at 2:11 PM, Karl Pauls <ka...@gmail.com> wrote:
>>> Yeah, if you could zip your project and send it to me in private mail
>>> (list probably wont accept it) - that would be a good start.
>>>
>>> regards,
>>>
>>> Karl
>>>
>>> On Tue, Feb 16, 2010 at 1:53 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>>>> Thanks Karl. Would it help if I zipped the jetty and test bundle I'm using?
>>>>
>>>> Thanks
>>>>
>>>> Bruce
>>>>
>>>>
>>>> On 16/02/2010 12:51, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>
>>>>> I'll try to look into it tonight.
>>>>>
>>>>> regards,
>>>>>
>>>>> Karl
>>>>>
>>>>> On Tue, Feb 16, 2010 at 12:54 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>> wrote:
>>>>>> Further to this, I have explored the problem some more. Using the dedexer
>>>>>> tool (http://dedexer.sourceforge.net/) I can examine the classes that have
>>>>>> been put into the classes.dex in the Jetty Http service bundle. I can see
>>>>>> in
>>>>>> the bundle that I do indeed have the required classes in the dex file:
>>>>>>
>>>>>> Processing org/mortbay/jetty/servlet/ServletHandler
>>>>>> Processing org/mortbay/jetty/servlet/ServletHolder$Config
>>>>>> Processing org/mortbay/jetty/servlet/OsgiServletHttpContext
>>>>>> Processing org/mortbay/jetty/servlet/ServletHandler$Context
>>>>>>
>>>>>> This is a mystery. Any ideas anyone?
>>>>>>
>>>>>>
>>>>>> On 16/02/2010 10:12, "Bruce Jackson" <br...@qualcomm.com> wrote:
>>>>>>
>>>>>>> org.mortbay.jetty.servlet.ServletHandler
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Karl Pauls
>>> karlpauls@gmail.com
>>>
>>
>>
>
>



-- 
Karl Pauls
karlpauls@gmail.com

Re: Felix on Android

Posted by "Jackson, Bruce" <br...@qualcomm.com>.
Hi Karl

I just tried that, and it makes no difference.
I'll mail you the bundles as discussed in a couple of minutes.

Thanks

Bruce


On 16/02/2010 15:33, "Karl Pauls" <ka...@gmail.com> wrote:

> Btw. can you first try to set the following property:
> 
> org.osgi.framework.bundle.parent=framework
> 
> and see whether that makes a difference on android?
> 
> regards,
> 
> Karl
> 
> On Tue, Feb 16, 2010 at 2:11 PM, Karl Pauls <ka...@gmail.com> wrote:
>> Yeah, if you could zip your project and send it to me in private mail
>> (list probably wont accept it) - that would be a good start.
>> 
>> regards,
>> 
>> Karl
>> 
>> On Tue, Feb 16, 2010 at 1:53 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>>> Thanks Karl. Would it help if I zipped the jetty and test bundle I'm using?
>>> 
>>> Thanks
>>> 
>>> Bruce
>>> 
>>> 
>>> On 16/02/2010 12:51, "Karl Pauls" <ka...@gmail.com> wrote:
>>> 
>>>> I'll try to look into it tonight.
>>>> 
>>>> regards,
>>>> 
>>>> Karl
>>>> 
>>>> On Tue, Feb 16, 2010 at 12:54 PM, Jackson, Bruce <br...@qualcomm.com>
>>>> wrote:
>>>>> Further to this, I have explored the problem some more. Using the dedexer
>>>>> tool (http://dedexer.sourceforge.net/) I can examine the classes that have
>>>>> been put into the classes.dex in the Jetty Http service bundle. I can see
>>>>> in
>>>>> the bundle that I do indeed have the required classes in the dex file:
>>>>> 
>>>>> Processing org/mortbay/jetty/servlet/ServletHandler
>>>>> Processing org/mortbay/jetty/servlet/ServletHolder$Config
>>>>> Processing org/mortbay/jetty/servlet/OsgiServletHttpContext
>>>>> Processing org/mortbay/jetty/servlet/ServletHandler$Context
>>>>> 
>>>>> This is a mystery. Any ideas anyone?
>>>>> 
>>>>> 
>>>>> On 16/02/2010 10:12, "Bruce Jackson" <br...@qualcomm.com> wrote:
>>>>> 
>>>>>> org.mortbay.jetty.servlet.ServletHandler
>>>>> 
>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
>> 
>> --
>> Karl Pauls
>> karlpauls@gmail.com
>> 
> 
> 


Re: Felix on Android

Posted by Karl Pauls <ka...@gmail.com>.
Btw. can you first try to set the following property:

org.osgi.framework.bundle.parent=framework

and see whether that makes a difference on android?

regards,

Karl

On Tue, Feb 16, 2010 at 2:11 PM, Karl Pauls <ka...@gmail.com> wrote:
> Yeah, if you could zip your project and send it to me in private mail
> (list probably wont accept it) - that would be a good start.
>
> regards,
>
> Karl
>
> On Tue, Feb 16, 2010 at 1:53 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>> Thanks Karl. Would it help if I zipped the jetty and test bundle I'm using?
>>
>> Thanks
>>
>> Bruce
>>
>>
>> On 16/02/2010 12:51, "Karl Pauls" <ka...@gmail.com> wrote:
>>
>>> I'll try to look into it tonight.
>>>
>>> regards,
>>>
>>> Karl
>>>
>>> On Tue, Feb 16, 2010 at 12:54 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>>>> Further to this, I have explored the problem some more. Using the dedexer
>>>> tool (http://dedexer.sourceforge.net/) I can examine the classes that have
>>>> been put into the classes.dex in the Jetty Http service bundle. I can see in
>>>> the bundle that I do indeed have the required classes in the dex file:
>>>>
>>>> Processing org/mortbay/jetty/servlet/ServletHandler
>>>> Processing org/mortbay/jetty/servlet/ServletHolder$Config
>>>> Processing org/mortbay/jetty/servlet/OsgiServletHttpContext
>>>> Processing org/mortbay/jetty/servlet/ServletHandler$Context
>>>>
>>>> This is a mystery. Any ideas anyone?
>>>>
>>>>
>>>> On 16/02/2010 10:12, "Bruce Jackson" <br...@qualcomm.com> wrote:
>>>>
>>>>> org.mortbay.jetty.servlet.ServletHandler
>>>>
>>>>
>>>
>>>
>>
>>
>
>
>
> --
> Karl Pauls
> karlpauls@gmail.com
>



-- 
Karl Pauls
karlpauls@gmail.com

Re: Felix on Android

Posted by Karl Pauls <ka...@gmail.com>.
Yeah, if you could zip your project and send it to me in private mail
(list probably wont accept it) - that would be a good start.

regards,

Karl

On Tue, Feb 16, 2010 at 1:53 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
> Thanks Karl. Would it help if I zipped the jetty and test bundle I'm using?
>
> Thanks
>
> Bruce
>
>
> On 16/02/2010 12:51, "Karl Pauls" <ka...@gmail.com> wrote:
>
>> I'll try to look into it tonight.
>>
>> regards,
>>
>> Karl
>>
>> On Tue, Feb 16, 2010 at 12:54 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>>> Further to this, I have explored the problem some more. Using the dedexer
>>> tool (http://dedexer.sourceforge.net/) I can examine the classes that have
>>> been put into the classes.dex in the Jetty Http service bundle. I can see in
>>> the bundle that I do indeed have the required classes in the dex file:
>>>
>>> Processing org/mortbay/jetty/servlet/ServletHandler
>>> Processing org/mortbay/jetty/servlet/ServletHolder$Config
>>> Processing org/mortbay/jetty/servlet/OsgiServletHttpContext
>>> Processing org/mortbay/jetty/servlet/ServletHandler$Context
>>>
>>> This is a mystery. Any ideas anyone?
>>>
>>>
>>> On 16/02/2010 10:12, "Bruce Jackson" <br...@qualcomm.com> wrote:
>>>
>>>> org.mortbay.jetty.servlet.ServletHandler
>>>
>>>
>>
>>
>
>



-- 
Karl Pauls
karlpauls@gmail.com

Re: Felix on Android

Posted by "Jackson, Bruce" <br...@qualcomm.com>.
Thanks Karl. Would it help if I zipped the jetty and test bundle I'm using?

Thanks

Bruce


On 16/02/2010 12:51, "Karl Pauls" <ka...@gmail.com> wrote:

> I'll try to look into it tonight.
> 
> regards,
> 
> Karl
> 
> On Tue, Feb 16, 2010 at 12:54 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>> Further to this, I have explored the problem some more. Using the dedexer
>> tool (http://dedexer.sourceforge.net/) I can examine the classes that have
>> been put into the classes.dex in the Jetty Http service bundle. I can see in
>> the bundle that I do indeed have the required classes in the dex file:
>> 
>> Processing org/mortbay/jetty/servlet/ServletHandler
>> Processing org/mortbay/jetty/servlet/ServletHolder$Config
>> Processing org/mortbay/jetty/servlet/OsgiServletHttpContext
>> Processing org/mortbay/jetty/servlet/ServletHandler$Context
>> 
>> This is a mystery. Any ideas anyone?
>> 
>> 
>> On 16/02/2010 10:12, "Bruce Jackson" <br...@qualcomm.com> wrote:
>> 
>>> org.mortbay.jetty.servlet.ServletHandler
>> 
>> 
> 
> 


Re: Felix on Android

Posted by Karl Pauls <ka...@gmail.com>.
I'll try to look into it tonight.

regards,

Karl

On Tue, Feb 16, 2010 at 12:54 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
> Further to this, I have explored the problem some more. Using the dedexer
> tool (http://dedexer.sourceforge.net/) I can examine the classes that have
> been put into the classes.dex in the Jetty Http service bundle. I can see in
> the bundle that I do indeed have the required classes in the dex file:
>
> Processing org/mortbay/jetty/servlet/ServletHandler
> Processing org/mortbay/jetty/servlet/ServletHolder$Config
> Processing org/mortbay/jetty/servlet/OsgiServletHttpContext
> Processing org/mortbay/jetty/servlet/ServletHandler$Context
>
> This is a mystery. Any ideas anyone?
>
>
> On 16/02/2010 10:12, "Bruce Jackson" <br...@qualcomm.com> wrote:
>
>> org.mortbay.jetty.servlet.ServletHandler
>
>



-- 
Karl Pauls
karlpauls@gmail.com

Re: Felix on Android

Posted by "Jackson, Bruce" <br...@qualcomm.com>.
Further to this, I have explored the problem some more. Using the dedexer
tool (http://dedexer.sourceforge.net/) I can examine the classes that have
been put into the classes.dex in the Jetty Http service bundle. I can see in
the bundle that I do indeed have the required classes in the dex file:

Processing org/mortbay/jetty/servlet/ServletHandler
Processing org/mortbay/jetty/servlet/ServletHolder$Config
Processing org/mortbay/jetty/servlet/OsgiServletHttpContext
Processing org/mortbay/jetty/servlet/ServletHandler$Context

This is a mystery. Any ideas anyone?


On 16/02/2010 10:12, "Bruce Jackson" <br...@qualcomm.com> wrote:

> org.mortbay.jetty.servlet.ServletHandler


Re: Felix on Android

Posted by "Jackson, Bruce" <br...@qualcomm.com>.
I think there's more to this than me being a bit thick :-)

I now have the same environment on both my mac and Nexus, namely:

(on the mac)

-> ps
START LEVEL 1
   ID   State         Level  Name
[   0] [Active     ] [    0] System Bundle (2.0.3)
[   1] [Active     ] [    1] Apache Felix Bundle Repository (1.4.3)
[   2] [Active     ] [    1] Apache Felix Shell Service (1.4.2)
[   3] [Active     ] [    1] Apache Felix Shell TUI (1.4.1)
[   4] [Active     ] [    1] Httptest (1.0.0.201002151713)
[   5] [Active     ] [    1] Servlet API Bundle (2.5.0.v200806031605)
[   6] [Active     ] [    1] HTTP Service (0.8.0.SNAPSHOT)

and (on the Nexus)

-> ps
START LEVEL 1
   ID   State         Level  Name
[   0] [Active     ] [    0] System Bundle (2.0.3)
[   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
[   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
[   4] [Active     ] [    1] Apache Felix Log Service (1.0.0)
[   5] [Active     ] [    1] Apache Felix Configuration Admin Service (1.2.4)
[   9] [Active     ] [    1] Servlet API Bundle (2.5.0.v200806031605)
[  10] [Active     ] [    1] HTTP Service (0.8.0.SNAPSHOT)
[  13] [Resolved   ] [    1] Httptest (1.0.0.201002151713)

Now, you’ll see from the above that on the Nexus, my very simple HTTP test bundle (it just registers a servlet context at /test and prints Hello World!) is resolved and not active. If I try to start it, I get the following:

-> start 13
Feb 16, 2010 10:09:56 AM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
org.osgi.framework.BundleException: Activator start error in bundle com.skifta.httptest [13].
    at org.apache.felix.framework.Felix.activateBundle(Felix.java:1803)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1678)
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:905)
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:892)
    at org.apache.felix.shell.impl.StartCommandImpl.execute(StartCommandImpl.java:82)
    at org.apache.felix.shell.impl.Activator$ShellServiceImpl.executeCommand(Activator.java:276)
    at org.apache.felix.shell.tui.Activator$ShellTuiRunnable.run(Activator.java:167)
    at java.lang.Thread.run(Thread.java:1096)
Caused by: java.lang.NoClassDefFoundError: org.mortbay.jetty.servlet.ServletHandler$Context
    at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:109)
    at org.mortbay.http.HttpContext.addHandler(HttpContext.java:465)
    at org.mortbay.http.HttpContext.addHandler(HttpContext.java:476)
    at org.apache.felix.http.jetty.HttpServiceImpl$ServletContextGroup.init(HttpServiceImpl.java:318)
    at org.apache.felix.http.jetty.HttpServiceImpl$ServletContextGroup.<init>(HttpServiceImpl.java:301)
    at org.apache.felix.http.jetty.HttpServiceImpl$ServletContextGroup.<init>(HttpServiceImpl.java:291)
    at org.apache.felix.http.jetty.HttpServiceImpl.registerServlet(HttpServiceImpl.java:128)
    at com.skifta.httptest.Activator.start(Activator.java:21)
    at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:661)
    at org.apache.felix.framework.Felix.activateBundle(Felix.java:1756)
    ... 7 more
Caused by: java.lang.UnsupportedOperationException: can't load this type of class file
    at java.lang.VMClassLoader.defineClass(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:338)
    at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1837)
    at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:723)
    at org.apache.felix.framework.ModuleImpl.access$100(ModuleImpl.java:61)
    at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1698)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:532)
    ... 17 more
java.lang.NoClassDefFoundError: org.mortbay.jetty.servlet.ServletHandler$Context

Several things. First, the behavoiur is not the some on the mac and Nexus, even though the framework and bundles are. Second, the class org.mortbay.jetty.servlet.ServletHandler$Context is in the Jetty bundle , it just can’t be resolved on Android.

Any ideas?


On 15/02/2010 18:14, "Clement Escoffier" <cl...@gmail.com> wrote:

> As said by Marcel, you need to also deploy the OSGi compendium
> On Android, I use:
> http://repo2.maven.org/maven2/org/apache/felix/org.osgi.compendium/1.4.0/org.o
> sgi.compendium-1.4.0.jar
>
>
> Clement
>
> On 15.02.2010, at 16:52, Jackson, Bruce wrote:
>
>> What other bundles do you have installed when running this?
>> I've added the following:
>>
>> -> ps
>> START LEVEL 1
>>   ID   State         Level  Name
>> [   0] [Active     ] [    0] System Bundle (2.0.3)
>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
>> [   4] [Active     ] [    1] Apache Felix Log Service (1.0.0)
>> [   5] [Active     ] [    1] Apache Felix Configuration Admin Service (1.2.4)
>> [   7] [Installed  ] [    1] HTTP Service (1.0.0)
>> [   9] [Active     ] [    1] Servlet API Bundle (2.5.0.v200806031605)
>>
>> but I still find that the HTTP service 1.0 complains that:
>>
>> org.osgi.framework.BundleException: Unresolved constraint in bundle
>> org.apache.felix.http.jetty [7]: package;
>> (&(package=org.osgi.service.http)(version>=1.2.0))
>>
>> when I start the http service?
>>
>> On 15/02/2010 13:14, "Clement Escoffier" <cl...@gmail.com> wrote:
>>
>>>
>>> On 15.02.2010, at 13:31, Jackson, Bruce wrote:
>>>
>>>> Clement, when you say 'I use the HTTP Service 1.0.0. Could you try with
>>>> that
>>>> one ?' which one do you mean?
>>>
>>> I use a older version of the HTTP service implementation (the version 1.0.0
>>> which use an older version of Jetty).
>>> http://archive.apache.org/dist/felix/org.apache.felix.http.jetty-1.0.0-proje
>>> ct
>>> .zip
>>> http://archive.apache.org/dist/felix/org.apache.felix.http.jetty-1.0.0.jar
>>>
>>> Try with this bundle. But for sure, use on of the latest Felix framework. We
>>> did a couple of fixes to support android correctly.
>>>
>>> Regards,
>>>
>>> Clement
>>>
>>>
>>>
>>>
>>>>
>>>> Thanks
>>>> Bruce
>>>>
>>>>
>>>> On 12/02/2010 18:57, "Clement Escoffier" <cl...@gmail.com>
>>>> wrote:
>>>>
>>>>>
>>>>> On 12.02.2010, at 17:27, Jackson, Bruce wrote:
>>>>>
>>>>>> I've got the Felix framework installed on my Nexus. If I download the
>>>>>> org.apache.felix.http.jetty-2.0.4.jar bundle from the Felix site, dx it
>>>>>> (which generates piles of warnings) push it to the phone, start Felix and
>>>>>> then install the jetty bundle, Felix just hangs:
>>>>>>
>>>>>> -> ps
>>>>>> START LEVEL 1
>>>>>> ID   State         Level  Name
>>>>>> [   0] [Active     ] [    0] System Bundle (1.4.0)
>>>>>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
>>>>>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
>>>>>> [   3] [Active     ] [    1] JDOM (1.0.0.v200803070505)
>>>>>> -> install file:bundle/org.apache.felix.http.jetty-2.0.4.jar
>>>>>> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
>>>>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>>>>> better to be explicit if an 8k-char buffer is required.
>>>>>> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
>>>>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>>>>> better to be explicit if an 8k-char buffer is required.
>>>>>> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
>>>>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>>>>> better to be explicit if an 8k-char buffer is required.
>>>>>> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
>>>>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>>>>> better to be explicit if an 8k-char buffer is required.
>>>>>> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
>>>>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>>>>> better to be explicit if an 8k-char buffer is required.
>>>>>> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
>>>>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>>>>> better to be explicit if an 8k-char buffer is required.
>>>>>> Bundle ID: 5
>>>>>> -> ps
>>>>>> START LEVEL 1
>>>>>> ID   State         Level  Name
>>>>>> [   0] [Active     ] [    0] System Bundle (1.4.0)
>>>>>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
>>>>>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
>>>>>> [   3] [Active     ] [    1] JDOM (1.0.0.v200803070505)
>>>>>> [   5] [Installed  ] [    1] Apache Felix Http Jetty (2.0.4)
>>>>>> -> start 5
>>>>>> Feb 12, 2010 4:15:08 PM java.io.BufferedWriter <init>
>>>>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>>>>> better to be explicit if an 8k-char buffer is required.
>>>>>> DEBUG: WIRE: 5.0 -> javax.xml.parsers -> 0
>>>>>> DEBUG: WIRE: 5.0 -> org.xml.sax -> 0
>>>>>> DEBUG: WIRE: 5.0 -> javax.servlet.resources -> 5.0
>>>>>> DEBUG: WIRE: 5.0 -> javax.servlet -> 5.0
>>>>>> DEBUG: WIRE: 5.0 -> javax.security.cert -> 0
>>>>>> DEBUG: WIRE: 5.0 -> org.osgi.util.tracker -> 0
>>>>>> DEBUG: WIRE: 5.0 -> org.osgi.framework -> 0
>>>>>> DEBUG: WIRE: 5.0 -> javax.servlet.jsp.resources -> 5.0
>>>>>> DEBUG: WIRE: 5.0 -> javax.net.ssl -> 0
>>>>>> DEBUG: WIRE: 5.0 -> org.xml.sax.helpers -> 0
>>>>>> DEBUG: WIRE: 5.0 -> org.osgi.service.http -> 5.0
>>>>>> DEBUG: WIRE: 5.0 -> org.apache.felix.http.api -> 5.0
>>>>>> DEBUG: WIRE: 5.0 -> javax.servlet.http -> 5.0
>>>>>>
>>>>>> At this point, I have to CTRL-C to kill Felix. The same thing happened
>>>>>> before
>>>>>> I compiled JDOM with 1.5+. I might be missing something, but my
>>>>>> assumption,
>>>>>> perhaps wrong, was that it was the compiler version that was causing this
>>>>>> behavior?
>>>>>
>>>>> Hum interesting,
>>>>>
>>>>> Potentially this is very slow, or there is an issue with the NIO.
>>>>> I use the HTTP Service 1.0.0. Could you try with that one ?
>>>>>
>>>>>
>>>>> Clement
>>>>>
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Bruce
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 12/02/2010 15:51, "Clement Escoffier" <cl...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>>
>>>>>>> On 12.02.2010, at 16:45, Jackson, Bruce wrote:
>>>>>>>
>>>>>>>> Whenever you dx a bundle which has been built with a pre-1.5 compiler
>>>>>>>> you
>>>>>>>> will usually get a pile of:
>>>>>>>>
>>>>>>>> warning: Ignoring InnerClasses attribute for an anonymous inner class
>>>>>>>> that
>>>>>>>> doesn't come with an associated EnclosingMethod attribute. (This class
>>>>>>>> was
>>>>>>>> probably produced by a broken compiler.)
>>>>>>>>
>>>>>>>> ...messages (assuming that you do use inner classes in the bundle).
>>>>>>>> These
>>>>>>>> are generated because the bundle was compiled with a pre-1.5 compiler.
>>>>>>>> With
>>>>>>>> something like the org.jdom bundle, the bundle will not work correctly
>>>>>>>> if
>>>>>>>> it
>>>>>>>> was compiled with a pre-1.5 compiler and then dx-ed, while using a
>>>>>>>> post-1.5
>>>>>>>> it does.
>>>>>>>>
>>>>>>>> It may a be a broad assessment of the situation, but I took this
>>>>>>>> experience
>>>>>>>> to indicate that it was required to build bundles with a post-1.5
>>>>>>>> compiler.
>>>>>>>> Indeed if you look around the web, you'll see this warning mentioned in
>>>>>>>> relation to a number of problems people are having with getting apps
>>>>>>>> running
>>>>>>>> on Android, when using JARs that were compiled pre-1.5.
>>>>>>>
>>>>>>> Well, you got less messages if you compile with 1.5+, but that's does
>>>>>>> say
>>>>>>> that
>>>>>>> a bundle will not work.
>>>>>>> When dexifying iPOJO, I have a couple of message too, but the complete
>>>>>>> iPOJO
>>>>>>> test suite works on Android (except some features using on the fly
>>>>>>> bytecode
>>>>>>> generation).
>>>>>>>
>>>>>>> Regards,
>>>>>>>
>>>>>>> Clement
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>>
>>>>>>>> Bruce
>>>>>>>>
>>>>>>>> On 12/02/2010 15:25, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> On Fri, Feb 12, 2010 at 4:22 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>>>>>> wrote:
>>>>>>>>>> I'm taking here about the ad-on bundles (like http, for example)
>>>>>>>>>> rather
>>>>>>>>>> than
>>>>>>>>>> the framework. The dx tool needs to have classes that were compiled
>>>>>>>>>> with
>>>>>>>>>> a
>>>>>>>>>> "new" compiler (i.e. greater than 1.5).
>>>>>>>>>
>>>>>>>>> Since when? Always worked for me. Again, the framework itself is
>>>>>>>>> compiled for 1.3...
>>>>>>>>>
>>>>>>>>> regards,
>>>>>>>>>
>>>>>>>>> Karl
>>>>>>>>>
>>>>>>>>>> Thanks
>>>>>>>>>>
>>>>>>>>>> Bruce
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 12/02/2010 13:33, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>> Why would you need 1.5 to be able to dex the bundle (the framework
>>>>>>>>>>> itself is build for 1.3 btw.)?
>>>>>>>>>>>
>>>>>>>>>>> regards,
>>>>>>>>>>>
>>>>>>>>>>> Karl
>>>>>>>>>>>
>>>>>>>>>>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce
>>>>>>>>>>> <br...@qualcomm.com>
>>>>>>>>>>> wrote:
>>>>>>>>>>>> Hi Pablo
>>>>>>>>>>>>
>>>>>>>>>>>> See the attached code. The biggest problem I've encountered is that
>>>>>>>>>>>> the
>>>>>>>>>>>> Felix distribution is a huge pain to build under JDK 1.5, and
>>>>>>>>>>>> therefore
>>>>>>>>>>>> to
>>>>>>>>>>>> be able to use some of the bundles (for example the http service)
>>>>>>>>>>>> that
>>>>>>>>>>>> are
>>>>>>>>>>>> part of the distribution. Its not a simple job of just changing a
>>>>>>>>>>>> couple
>>>>>>>>>>>> of
>>>>>>>>>>>> entries in POM files: some components download pre-built JAR files
>>>>>>>>>>>> from
>>>>>>>>>>>> the
>>>>>>>>>>>> web and explode these, thereby having classes built under 1.4 which
>>>>>>>>>>>> will
>>>>>>>>>>>> not
>>>>>>>>>>>> work when you dexify the bundles.
>>>>>>>>>>>>
>>>>>>>>>>>> This is something that would be great to see some work done on by
>>>>>>>>>>>> the
>>>>>>>>>>>> Felix
>>>>>>>>>>>> community, because while its true that the basic Felix core does
>>>>>>>>>>>> and
>>>>>>>>>>>> will
>>>>>>>>>>>> support Android, most of the add-on bundles wont.
>>>>>>>>>>>>
>>>>>>>>>>>> For my part, the ideal solution would be to see the whole framework
>>>>>>>>>>>> be
>>>>>>>>>>>> based
>>>>>>>>>>>> on JDK 1.5 and not 1.4.
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks
>>>>>>>>>>>>
>>>>>>>>>>>> Bruce
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>>>>>>>>>>> Do you have some advance?
>>>>>>>>>>>> Salutations, thanks.
>>>>>>>>>>>> Pablo.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Jackson, Bruce wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> The Felix site has a useful section on getting things going on
>>>>>>>>>>>> Android >>>>>>>> (
>>>>>>>>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html)
>>>>>>>>>>>> but
>>>>>>>>>>>> isn't
>>>>>>>>>>>> so clear about embedding the framework into an Android app"
>>>>>>>>>>>>
>>>>>>>>>>>> "Apache Felix can also be integrated with an Android application.
>>>>>>>>>>>> To
>>>>>>>>>>>> achieve
>>>>>>>>>>>> this, you need to embed Felix into onCreate() method of your
>>>>>>>>>>>> Activity
>>>>>>>>>>>> class
>>>>>>>>>>>> (see Android docs for more details on how to use an Activity) and
>>>>>>>>>>>> process
>>>>>>>>>>>> your bundles as shown above."
>>>>>>>>>>>>
>>>>>>>>>>>> Has anyone got an example of how you do this? I understand how to
>>>>>>>>>>>> write
>>>>>>>>>>>> the
>>>>>>>>>>>> Android app, and I get the point being made here. What I need to
>>>>>>>>>>>> understand
>>>>>>>>>>>> is:
>>>>>>>>>>>>
>>>>>>>>>>>> 1. How do you launch the Felix framework. What do I need to
>>>>>>>>>>>> instantiate?
>>>>>>>>>>>> 2. Where does the framework get its boot configuration (i.e. what
>>>>>>>>>>>> bundles
>>>>>>>>>>>> to
>>>>>>>>>>>> load, run levels, environment variables, etc) from in this case?
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>
>>>>
>>>
>

Re: Felix on Android

Posted by Clement Escoffier <cl...@gmail.com>.
As said by Marcel, you need to also deploy the OSGi compendium
On Android, I use: http://repo2.maven.org/maven2/org/apache/felix/org.osgi.compendium/1.4.0/org.osgi.compendium-1.4.0.jar


Clement

On 15.02.2010, at 16:52, Jackson, Bruce wrote:

> What other bundles do you have installed when running this?
> I've added the following:
> 
> -> ps
> START LEVEL 1
>   ID   State         Level  Name
> [   0] [Active     ] [    0] System Bundle (2.0.3)
> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
> [   4] [Active     ] [    1] Apache Felix Log Service (1.0.0)
> [   5] [Active     ] [    1] Apache Felix Configuration Admin Service (1.2.4)
> [   7] [Installed  ] [    1] HTTP Service (1.0.0)
> [   9] [Active     ] [    1] Servlet API Bundle (2.5.0.v200806031605)
> 
> but I still find that the HTTP service 1.0 complains that:
> 
> org.osgi.framework.BundleException: Unresolved constraint in bundle org.apache.felix.http.jetty [7]: package; (&(package=org.osgi.service.http)(version>=1.2.0))
> 
> when I start the http service?
> 
> On 15/02/2010 13:14, "Clement Escoffier" <cl...@gmail.com> wrote:
> 
>> 
>> On 15.02.2010, at 13:31, Jackson, Bruce wrote:
>> 
>>> Clement, when you say 'I use the HTTP Service 1.0.0. Could you try with that
>>> one ?' which one do you mean?
>> 
>> I use a older version of the HTTP service implementation (the version 1.0.0
>> which use an older version of Jetty).
>> http://archive.apache.org/dist/felix/org.apache.felix.http.jetty-1.0.0-project
>> .zip
>> http://archive.apache.org/dist/felix/org.apache.felix.http.jetty-1.0.0.jar
>> 
>> Try with this bundle. But for sure, use on of the latest Felix framework. We
>> did a couple of fixes to support android correctly.
>> 
>> Regards,
>> 
>> Clement
>> 
>> 
>> 
>> 
>>> 
>>> Thanks
>>> Bruce
>>> 
>>> 
>>> On 12/02/2010 18:57, "Clement Escoffier" <cl...@gmail.com>
>>> wrote:
>>> 
>>>> 
>>>> On 12.02.2010, at 17:27, Jackson, Bruce wrote:
>>>> 
>>>>> I've got the Felix framework installed on my Nexus. If I download the
>>>>> org.apache.felix.http.jetty-2.0.4.jar bundle from the Felix site, dx it
>>>>> (which generates piles of warnings) push it to the phone, start Felix and
>>>>> then install the jetty bundle, Felix just hangs:
>>>>> 
>>>>> -> ps
>>>>> START LEVEL 1
>>>>> ID   State         Level  Name
>>>>> [   0] [Active     ] [    0] System Bundle (1.4.0)
>>>>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
>>>>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
>>>>> [   3] [Active     ] [    1] JDOM (1.0.0.v200803070505)
>>>>> -> install file:bundle/org.apache.felix.http.jetty-2.0.4.jar
>>>>> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
>>>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>>>> better to be explicit if an 8k-char buffer is required.
>>>>> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
>>>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>>>> better to be explicit if an 8k-char buffer is required.
>>>>> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
>>>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>>>> better to be explicit if an 8k-char buffer is required.
>>>>> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
>>>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>>>> better to be explicit if an 8k-char buffer is required.
>>>>> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
>>>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>>>> better to be explicit if an 8k-char buffer is required.
>>>>> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
>>>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>>>> better to be explicit if an 8k-char buffer is required.
>>>>> Bundle ID: 5
>>>>> -> ps
>>>>> START LEVEL 1
>>>>> ID   State         Level  Name
>>>>> [   0] [Active     ] [    0] System Bundle (1.4.0)
>>>>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
>>>>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
>>>>> [   3] [Active     ] [    1] JDOM (1.0.0.v200803070505)
>>>>> [   5] [Installed  ] [    1] Apache Felix Http Jetty (2.0.4)
>>>>> -> start 5
>>>>> Feb 12, 2010 4:15:08 PM java.io.BufferedWriter <init>
>>>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>>>> better to be explicit if an 8k-char buffer is required.
>>>>> DEBUG: WIRE: 5.0 -> javax.xml.parsers -> 0
>>>>> DEBUG: WIRE: 5.0 -> org.xml.sax -> 0
>>>>> DEBUG: WIRE: 5.0 -> javax.servlet.resources -> 5.0
>>>>> DEBUG: WIRE: 5.0 -> javax.servlet -> 5.0
>>>>> DEBUG: WIRE: 5.0 -> javax.security.cert -> 0
>>>>> DEBUG: WIRE: 5.0 -> org.osgi.util.tracker -> 0
>>>>> DEBUG: WIRE: 5.0 -> org.osgi.framework -> 0
>>>>> DEBUG: WIRE: 5.0 -> javax.servlet.jsp.resources -> 5.0
>>>>> DEBUG: WIRE: 5.0 -> javax.net.ssl -> 0
>>>>> DEBUG: WIRE: 5.0 -> org.xml.sax.helpers -> 0
>>>>> DEBUG: WIRE: 5.0 -> org.osgi.service.http -> 5.0
>>>>> DEBUG: WIRE: 5.0 -> org.apache.felix.http.api -> 5.0
>>>>> DEBUG: WIRE: 5.0 -> javax.servlet.http -> 5.0
>>>>> 
>>>>> At this point, I have to CTRL-C to kill Felix. The same thing happened
>>>>> before
>>>>> I compiled JDOM with 1.5+. I might be missing something, but my assumption,
>>>>> perhaps wrong, was that it was the compiler version that was causing this
>>>>> behavior?
>>>> 
>>>> Hum interesting,
>>>> 
>>>> Potentially this is very slow, or there is an issue with the NIO.
>>>> I use the HTTP Service 1.0.0. Could you try with that one ?
>>>> 
>>>> 
>>>> Clement
>>>> 
>>>>> 
>>>>> Thanks
>>>>> 
>>>>> Bruce
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> On 12/02/2010 15:51, "Clement Escoffier" <cl...@gmail.com>
>>>>> wrote:
>>>>> 
>>>>>> 
>>>>>> On 12.02.2010, at 16:45, Jackson, Bruce wrote:
>>>>>> 
>>>>>>> Whenever you dx a bundle which has been built with a pre-1.5 compiler you
>>>>>>> will usually get a pile of:
>>>>>>> 
>>>>>>> warning: Ignoring InnerClasses attribute for an anonymous inner class
>>>>>>> that
>>>>>>> doesn't come with an associated EnclosingMethod attribute. (This class
>>>>>>> was
>>>>>>> probably produced by a broken compiler.)
>>>>>>> 
>>>>>>> ...messages (assuming that you do use inner classes in the bundle). These
>>>>>>> are generated because the bundle was compiled with a pre-1.5 compiler.
>>>>>>> With
>>>>>>> something like the org.jdom bundle, the bundle will not work correctly if
>>>>>>> it
>>>>>>> was compiled with a pre-1.5 compiler and then dx-ed, while using a
>>>>>>> post-1.5
>>>>>>> it does.
>>>>>>> 
>>>>>>> It may a be a broad assessment of the situation, but I took this
>>>>>>> experience
>>>>>>> to indicate that it was required to build bundles with a post-1.5
>>>>>>> compiler.
>>>>>>> Indeed if you look around the web, you'll see this warning mentioned in
>>>>>>> relation to a number of problems people are having with getting apps
>>>>>>> running
>>>>>>> on Android, when using JARs that were compiled pre-1.5.
>>>>>> 
>>>>>> Well, you got less messages if you compile with 1.5+, but that's does say
>>>>>> that
>>>>>> a bundle will not work.
>>>>>> When dexifying iPOJO, I have a couple of message too, but the complete
>>>>>> iPOJO
>>>>>> test suite works on Android (except some features using on the fly
>>>>>> bytecode
>>>>>> generation).
>>>>>> 
>>>>>> Regards,
>>>>>> 
>>>>>> Clement
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> 
>>>>>>> Thanks
>>>>>>> 
>>>>>>> Bruce
>>>>>>> 
>>>>>>> On 12/02/2010 15:25, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>>>> 
>>>>>>>> On Fri, Feb 12, 2010 at 4:22 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>>>>> wrote:
>>>>>>>>> I'm taking here about the ad-on bundles (like http, for example) rather
>>>>>>>>> than
>>>>>>>>> the framework. The dx tool needs to have classes that were compiled
>>>>>>>>> with
>>>>>>>>> a
>>>>>>>>> "new" compiler (i.e. greater than 1.5).
>>>>>>>> 
>>>>>>>> Since when? Always worked for me. Again, the framework itself is
>>>>>>>> compiled for 1.3...
>>>>>>>> 
>>>>>>>> regards,
>>>>>>>> 
>>>>>>>> Karl
>>>>>>>> 
>>>>>>>>> Thanks
>>>>>>>>> 
>>>>>>>>> Bruce
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> On 12/02/2010 13:33, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>>>>>> 
>>>>>>>>>> Why would you need 1.5 to be able to dex the bundle (the framework
>>>>>>>>>> itself is build for 1.3 btw.)?
>>>>>>>>>> 
>>>>>>>>>> regards,
>>>>>>>>>> 
>>>>>>>>>> Karl
>>>>>>>>>> 
>>>>>>>>>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>>>>>>> wrote:
>>>>>>>>>>> Hi Pablo
>>>>>>>>>>> 
>>>>>>>>>>> See the attached code. The biggest problem I've encountered is that
>>>>>>>>>>> the
>>>>>>>>>>> Felix distribution is a huge pain to build under JDK 1.5, and
>>>>>>>>>>> therefore
>>>>>>>>>>> to
>>>>>>>>>>> be able to use some of the bundles (for example the http service)
>>>>>>>>>>> that
>>>>>>>>>>> are
>>>>>>>>>>> part of the distribution. Its not a simple job of just changing a
>>>>>>>>>>> couple
>>>>>>>>>>> of
>>>>>>>>>>> entries in POM files: some components download pre-built JAR files
>>>>>>>>>>> from
>>>>>>>>>>> the
>>>>>>>>>>> web and explode these, thereby having classes built under 1.4 which
>>>>>>>>>>> will
>>>>>>>>>>> not
>>>>>>>>>>> work when you dexify the bundles.
>>>>>>>>>>> 
>>>>>>>>>>> This is something that would be great to see some work done on by the
>>>>>>>>>>> Felix
>>>>>>>>>>> community, because while its true that the basic Felix core does and
>>>>>>>>>>> will
>>>>>>>>>>> support Android, most of the add-on bundles wont.
>>>>>>>>>>> 
>>>>>>>>>>> For my part, the ideal solution would be to see the whole framework
>>>>>>>>>>> be
>>>>>>>>>>> based
>>>>>>>>>>> on JDK 1.5 and not 1.4.
>>>>>>>>>>> 
>>>>>>>>>>> Thanks
>>>>>>>>>>> 
>>>>>>>>>>> Bruce
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>>>>>>>>>>> Do you have some advance?
>>>>>>>>>>>> Salutations, thanks.
>>>>>>>>>>>> Pablo.
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> Jackson, Bruce wrote:
>>>>>>>>>>>>> 
>>>>>>>>>>>>> The Felix site has a useful section on getting things going on
>>>>>>>>>>>>> Android >>>>>>>> (
>>>>>>>>>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html)
>>>>>>>>>>>>> but
>>>>>>>>>>>>> isn't
>>>>>>>>>>>>> so clear about embedding the framework into an Android app"
>>>>>>>>>>>>> 
>>>>>>>>>>>>> "Apache Felix can also be integrated with an Android application.
>>>>>>>>>>>>> To
>>>>>>>>>>>>> achieve
>>>>>>>>>>>>> this, you need to embed Felix into onCreate() method of your
>>>>>>>>>>>>> Activity
>>>>>>>>>>>>> class
>>>>>>>>>>>>> (see Android docs for more details on how to use an Activity) and
>>>>>>>>>>>>> process
>>>>>>>>>>>>> your bundles as shown above."
>>>>>>>>>>>>> 
>>>>>>>>>>>>> Has anyone got an example of how you do this? I understand how to
>>>>>>>>>>>>> write
>>>>>>>>>>>>> the
>>>>>>>>>>>>> Android app, and I get the point being made here. What I need to
>>>>>>>>>>>>> understand
>>>>>>>>>>>>> is:
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 1. How do you launch the Felix framework. What do I need to
>>>>>>>>>>>>> instantiate?
>>>>>>>>>>>>> 2. Where does the framework get its boot configuration (i.e. what
>>>>>>>>>>>>> bundles
>>>>>>>>>>>>> to
>>>>>>>>>>>>> load, run levels, environment variables, etc) from in this case?
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>> 
>>>> 
>>> 
>> 


Re: Felix on Android

Posted by "Jackson, Bruce" <br...@qualcomm.com>.
What other bundles do you have installed when running this?
I've added the following:

-> ps
START LEVEL 1
   ID   State         Level  Name
[   0] [Active     ] [    0] System Bundle (2.0.3)
[   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
[   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
[   4] [Active     ] [    1] Apache Felix Log Service (1.0.0)
[   5] [Active     ] [    1] Apache Felix Configuration Admin Service (1.2.4)
[   7] [Installed  ] [    1] HTTP Service (1.0.0)
[   9] [Active     ] [    1] Servlet API Bundle (2.5.0.v200806031605)

but I still find that the HTTP service 1.0 complains that:

org.osgi.framework.BundleException: Unresolved constraint in bundle org.apache.felix.http.jetty [7]: package; (&(package=org.osgi.service.http)(version>=1.2.0))

when I start the http service?

On 15/02/2010 13:14, "Clement Escoffier" <cl...@gmail.com> wrote:

>
> On 15.02.2010, at 13:31, Jackson, Bruce wrote:
>
>> Clement, when you say 'I use the HTTP Service 1.0.0. Could you try with that
>> one ?' which one do you mean?
>
> I use a older version of the HTTP service implementation (the version 1.0.0
> which use an older version of Jetty).
> http://archive.apache.org/dist/felix/org.apache.felix.http.jetty-1.0.0-project
> .zip
> http://archive.apache.org/dist/felix/org.apache.felix.http.jetty-1.0.0.jar
>
> Try with this bundle. But for sure, use on of the latest Felix framework. We
> did a couple of fixes to support android correctly.
>
> Regards,
>
> Clement
>
>
>
>
>>
>> Thanks
>> Bruce
>>
>>
>> On 12/02/2010 18:57, "Clement Escoffier" <cl...@gmail.com>
>> wrote:
>>
>>>
>>> On 12.02.2010, at 17:27, Jackson, Bruce wrote:
>>>
>>>> I've got the Felix framework installed on my Nexus. If I download the
>>>> org.apache.felix.http.jetty-2.0.4.jar bundle from the Felix site, dx it
>>>> (which generates piles of warnings) push it to the phone, start Felix and
>>>> then install the jetty bundle, Felix just hangs:
>>>>
>>>> -> ps
>>>> START LEVEL 1
>>>>  ID   State         Level  Name
>>>> [   0] [Active     ] [    0] System Bundle (1.4.0)
>>>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
>>>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
>>>> [   3] [Active     ] [    1] JDOM (1.0.0.v200803070505)
>>>> -> install file:bundle/org.apache.felix.http.jetty-2.0.4.jar
>>>> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
>>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>>> better to be explicit if an 8k-char buffer is required.
>>>> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
>>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>>> better to be explicit if an 8k-char buffer is required.
>>>> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
>>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>>> better to be explicit if an 8k-char buffer is required.
>>>> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
>>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>>> better to be explicit if an 8k-char buffer is required.
>>>> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
>>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>>> better to be explicit if an 8k-char buffer is required.
>>>> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
>>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>>> better to be explicit if an 8k-char buffer is required.
>>>> Bundle ID: 5
>>>> -> ps
>>>> START LEVEL 1
>>>>  ID   State         Level  Name
>>>> [   0] [Active     ] [    0] System Bundle (1.4.0)
>>>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
>>>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
>>>> [   3] [Active     ] [    1] JDOM (1.0.0.v200803070505)
>>>> [   5] [Installed  ] [    1] Apache Felix Http Jetty (2.0.4)
>>>> -> start 5
>>>> Feb 12, 2010 4:15:08 PM java.io.BufferedWriter <init>
>>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>>> better to be explicit if an 8k-char buffer is required.
>>>> DEBUG: WIRE: 5.0 -> javax.xml.parsers -> 0
>>>> DEBUG: WIRE: 5.0 -> org.xml.sax -> 0
>>>> DEBUG: WIRE: 5.0 -> javax.servlet.resources -> 5.0
>>>> DEBUG: WIRE: 5.0 -> javax.servlet -> 5.0
>>>> DEBUG: WIRE: 5.0 -> javax.security.cert -> 0
>>>> DEBUG: WIRE: 5.0 -> org.osgi.util.tracker -> 0
>>>> DEBUG: WIRE: 5.0 -> org.osgi.framework -> 0
>>>> DEBUG: WIRE: 5.0 -> javax.servlet.jsp.resources -> 5.0
>>>> DEBUG: WIRE: 5.0 -> javax.net.ssl -> 0
>>>> DEBUG: WIRE: 5.0 -> org.xml.sax.helpers -> 0
>>>> DEBUG: WIRE: 5.0 -> org.osgi.service.http -> 5.0
>>>> DEBUG: WIRE: 5.0 -> org.apache.felix.http.api -> 5.0
>>>> DEBUG: WIRE: 5.0 -> javax.servlet.http -> 5.0
>>>>
>>>> At this point, I have to CTRL-C to kill Felix. The same thing happened
>>>> before
>>>> I compiled JDOM with 1.5+. I might be missing something, but my assumption,
>>>> perhaps wrong, was that it was the compiler version that was causing this
>>>> behavior?
>>>
>>> Hum interesting,
>>>
>>> Potentially this is very slow, or there is an issue with the NIO.
>>> I use the HTTP Service 1.0.0. Could you try with that one ?
>>>
>>>
>>> Clement
>>>
>>>>
>>>> Thanks
>>>>
>>>> Bruce
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> On 12/02/2010 15:51, "Clement Escoffier" <cl...@gmail.com>
>>>> wrote:
>>>>
>>>>>
>>>>> On 12.02.2010, at 16:45, Jackson, Bruce wrote:
>>>>>
>>>>>> Whenever you dx a bundle which has been built with a pre-1.5 compiler you
>>>>>> will usually get a pile of:
>>>>>>
>>>>>> warning: Ignoring InnerClasses attribute for an anonymous inner class
>>>>>> that
>>>>>> doesn't come with an associated EnclosingMethod attribute. (This class
>>>>>> was
>>>>>> probably produced by a broken compiler.)
>>>>>>
>>>>>> ...messages (assuming that you do use inner classes in the bundle). These
>>>>>> are generated because the bundle was compiled with a pre-1.5 compiler.
>>>>>> With
>>>>>> something like the org.jdom bundle, the bundle will not work correctly if
>>>>>> it
>>>>>> was compiled with a pre-1.5 compiler and then dx-ed, while using a
>>>>>> post-1.5
>>>>>> it does.
>>>>>>
>>>>>> It may a be a broad assessment of the situation, but I took this
>>>>>> experience
>>>>>> to indicate that it was required to build bundles with a post-1.5
>>>>>> compiler.
>>>>>> Indeed if you look around the web, you'll see this warning mentioned in
>>>>>> relation to a number of problems people are having with getting apps
>>>>>> running
>>>>>> on Android, when using JARs that were compiled pre-1.5.
>>>>>
>>>>> Well, you got less messages if you compile with 1.5+, but that's does say
>>>>> that
>>>>> a bundle will not work.
>>>>> When dexifying iPOJO, I have a couple of message too, but the complete
>>>>> iPOJO
>>>>> test suite works on Android (except some features using on the fly
>>>>> bytecode
>>>>> generation).
>>>>>
>>>>> Regards,
>>>>>
>>>>> Clement
>>>>>
>>>>>
>>>>>
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Bruce
>>>>>>
>>>>>> On 12/02/2010 15:25, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>>>
>>>>>>> On Fri, Feb 12, 2010 at 4:22 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>>>> wrote:
>>>>>>>> I'm taking here about the ad-on bundles (like http, for example) rather
>>>>>>>> than
>>>>>>>> the framework. The dx tool needs to have classes that were compiled
>>>>>>>> with
>>>>>>>> a
>>>>>>>> "new" compiler (i.e. greater than 1.5).
>>>>>>>
>>>>>>> Since when? Always worked for me. Again, the framework itself is
>>>>>>> compiled for 1.3...
>>>>>>>
>>>>>>> regards,
>>>>>>>
>>>>>>> Karl
>>>>>>>
>>>>>>>> Thanks
>>>>>>>>
>>>>>>>> Bruce
>>>>>>>>
>>>>>>>>
>>>>>>>> On 12/02/2010 13:33, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>> Why would you need 1.5 to be able to dex the bundle (the framework
>>>>>>>>> itself is build for 1.3 btw.)?
>>>>>>>>>
>>>>>>>>> regards,
>>>>>>>>>
>>>>>>>>> Karl
>>>>>>>>>
>>>>>>>>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>>>>>> wrote:
>>>>>>>>>> Hi Pablo
>>>>>>>>>>
>>>>>>>>>> See the attached code. The biggest problem I've encountered is that
>>>>>>>>>> the
>>>>>>>>>> Felix distribution is a huge pain to build under JDK 1.5, and
>>>>>>>>>> therefore
>>>>>>>>>> to
>>>>>>>>>> be able to use some of the bundles (for example the http service)
>>>>>>>>>> that
>>>>>>>>>> are
>>>>>>>>>> part of the distribution. Its not a simple job of just changing a
>>>>>>>>>> couple
>>>>>>>>>> of
>>>>>>>>>> entries in POM files: some components download pre-built JAR files
>>>>>>>>>> from
>>>>>>>>>> the
>>>>>>>>>> web and explode these, thereby having classes built under 1.4 which
>>>>>>>>>> will
>>>>>>>>>> not
>>>>>>>>>> work when you dexify the bundles.
>>>>>>>>>>
>>>>>>>>>> This is something that would be great to see some work done on by the
>>>>>>>>>> Felix
>>>>>>>>>> community, because while its true that the basic Felix core does and
>>>>>>>>>> will
>>>>>>>>>> support Android, most of the add-on bundles wont.
>>>>>>>>>>
>>>>>>>>>> For my part, the ideal solution would be to see the whole framework
>>>>>>>>>> be
>>>>>>>>>> based
>>>>>>>>>> on JDK 1.5 and not 1.4.
>>>>>>>>>>
>>>>>>>>>> Thanks
>>>>>>>>>>
>>>>>>>>>> Bruce
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>>>>>>>>>> Do you have some advance?
>>>>>>>>>>> Salutations, thanks.
>>>>>>>>>>> Pablo.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Jackson, Bruce wrote:
>>>>>>>>>>>>
>>>>>>>>>>>> The Felix site has a useful section on getting things going on
>>>>>>>>>>>> Android >>>>>>>> (
>>>>>>>>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html)
>>>>>>>>>>>> but
>>>>>>>>>>>> isn't
>>>>>>>>>>>> so clear about embedding the framework into an Android app"
>>>>>>>>>>>>
>>>>>>>>>>>> "Apache Felix can also be integrated with an Android application.
>>>>>>>>>>>> To
>>>>>>>>>>>> achieve
>>>>>>>>>>>> this, you need to embed Felix into onCreate() method of your
>>>>>>>>>>>> Activity
>>>>>>>>>>>> class
>>>>>>>>>>>> (see Android docs for more details on how to use an Activity) and
>>>>>>>>>>>> process
>>>>>>>>>>>> your bundles as shown above."
>>>>>>>>>>>>
>>>>>>>>>>>> Has anyone got an example of how you do this? I understand how to
>>>>>>>>>>>> write
>>>>>>>>>>>> the
>>>>>>>>>>>> Android app, and I get the point being made here. What I need to
>>>>>>>>>>>> understand
>>>>>>>>>>>> is:
>>>>>>>>>>>>
>>>>>>>>>>>> 1. How do you launch the Felix framework. What do I need to
>>>>>>>>>>>> instantiate?
>>>>>>>>>>>> 2. Where does the framework get its boot configuration (i.e. what
>>>>>>>>>>>> bundles
>>>>>>>>>>>> to
>>>>>>>>>>>> load, run levels, environment variables, etc) from in this case?
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>
>>
>

Re: Felix on Android

Posted by Clement Escoffier <cl...@gmail.com>.
On 15.02.2010, at 13:31, Jackson, Bruce wrote:

> Clement, when you say 'I use the HTTP Service 1.0.0. Could you try with that
> one ?' which one do you mean?

I use a older version of the HTTP service implementation (the version 1.0.0 which use an older version of Jetty).
http://archive.apache.org/dist/felix/org.apache.felix.http.jetty-1.0.0-project.zip
http://archive.apache.org/dist/felix/org.apache.felix.http.jetty-1.0.0.jar

Try with this bundle. But for sure, use on of the latest Felix framework. We did a couple of fixes to support android correctly.

Regards,

Clement




> 
> Thanks
> Bruce
> 
> 
> On 12/02/2010 18:57, "Clement Escoffier" <cl...@gmail.com>
> wrote:
> 
>> 
>> On 12.02.2010, at 17:27, Jackson, Bruce wrote:
>> 
>>> I've got the Felix framework installed on my Nexus. If I download the
>>> org.apache.felix.http.jetty-2.0.4.jar bundle from the Felix site, dx it
>>> (which generates piles of warnings) push it to the phone, start Felix and
>>> then install the jetty bundle, Felix just hangs:
>>> 
>>> -> ps
>>> START LEVEL 1
>>>  ID   State         Level  Name
>>> [   0] [Active     ] [    0] System Bundle (1.4.0)
>>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
>>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
>>> [   3] [Active     ] [    1] JDOM (1.0.0.v200803070505)
>>> -> install file:bundle/org.apache.felix.http.jetty-2.0.4.jar
>>> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>> better to be explicit if an 8k-char buffer is required.
>>> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>> better to be explicit if an 8k-char buffer is required.
>>> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>> better to be explicit if an 8k-char buffer is required.
>>> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>> better to be explicit if an 8k-char buffer is required.
>>> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>> better to be explicit if an 8k-char buffer is required.
>>> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>> better to be explicit if an 8k-char buffer is required.
>>> Bundle ID: 5
>>> -> ps
>>> START LEVEL 1
>>>  ID   State         Level  Name
>>> [   0] [Active     ] [    0] System Bundle (1.4.0)
>>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
>>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
>>> [   3] [Active     ] [    1] JDOM (1.0.0.v200803070505)
>>> [   5] [Installed  ] [    1] Apache Felix Http Jetty (2.0.4)
>>> -> start 5
>>> Feb 12, 2010 4:15:08 PM java.io.BufferedWriter <init>
>>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>>> better to be explicit if an 8k-char buffer is required.
>>> DEBUG: WIRE: 5.0 -> javax.xml.parsers -> 0
>>> DEBUG: WIRE: 5.0 -> org.xml.sax -> 0
>>> DEBUG: WIRE: 5.0 -> javax.servlet.resources -> 5.0
>>> DEBUG: WIRE: 5.0 -> javax.servlet -> 5.0
>>> DEBUG: WIRE: 5.0 -> javax.security.cert -> 0
>>> DEBUG: WIRE: 5.0 -> org.osgi.util.tracker -> 0
>>> DEBUG: WIRE: 5.0 -> org.osgi.framework -> 0
>>> DEBUG: WIRE: 5.0 -> javax.servlet.jsp.resources -> 5.0
>>> DEBUG: WIRE: 5.0 -> javax.net.ssl -> 0
>>> DEBUG: WIRE: 5.0 -> org.xml.sax.helpers -> 0
>>> DEBUG: WIRE: 5.0 -> org.osgi.service.http -> 5.0
>>> DEBUG: WIRE: 5.0 -> org.apache.felix.http.api -> 5.0
>>> DEBUG: WIRE: 5.0 -> javax.servlet.http -> 5.0
>>> 
>>> At this point, I have to CTRL-C to kill Felix. The same thing happened before
>>> I compiled JDOM with 1.5+. I might be missing something, but my assumption,
>>> perhaps wrong, was that it was the compiler version that was causing this
>>> behavior?
>> 
>> Hum interesting,
>> 
>> Potentially this is very slow, or there is an issue with the NIO.
>> I use the HTTP Service 1.0.0. Could you try with that one ?
>> 
>> 
>> Clement
>> 
>>> 
>>> Thanks
>>> 
>>> Bruce
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> On 12/02/2010 15:51, "Clement Escoffier" <cl...@gmail.com> wrote:
>>> 
>>>> 
>>>> On 12.02.2010, at 16:45, Jackson, Bruce wrote:
>>>> 
>>>>> Whenever you dx a bundle which has been built with a pre-1.5 compiler you
>>>>> will usually get a pile of:
>>>>> 
>>>>> warning: Ignoring InnerClasses attribute for an anonymous inner class that
>>>>> doesn't come with an associated EnclosingMethod attribute. (This class was
>>>>> probably produced by a broken compiler.)
>>>>> 
>>>>> ...messages (assuming that you do use inner classes in the bundle). These
>>>>> are generated because the bundle was compiled with a pre-1.5 compiler. With
>>>>> something like the org.jdom bundle, the bundle will not work correctly if
>>>>> it
>>>>> was compiled with a pre-1.5 compiler and then dx-ed, while using a post-1.5
>>>>> it does.
>>>>> 
>>>>> It may a be a broad assessment of the situation, but I took this experience
>>>>> to indicate that it was required to build bundles with a post-1.5 compiler.
>>>>> Indeed if you look around the web, you'll see this warning mentioned in
>>>>> relation to a number of problems people are having with getting apps
>>>>> running
>>>>> on Android, when using JARs that were compiled pre-1.5.
>>>> 
>>>> Well, you got less messages if you compile with 1.5+, but that's does say
>>>> that
>>>> a bundle will not work.
>>>> When dexifying iPOJO, I have a couple of message too, but the complete iPOJO
>>>> test suite works on Android (except some features using on the fly bytecode
>>>> generation).
>>>> 
>>>> Regards,
>>>> 
>>>> Clement
>>>> 
>>>> 
>>>> 
>>>>> 
>>>>> Thanks
>>>>> 
>>>>> Bruce
>>>>> 
>>>>> On 12/02/2010 15:25, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>> 
>>>>>> On Fri, Feb 12, 2010 at 4:22 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>>> wrote:
>>>>>>> I'm taking here about the ad-on bundles (like http, for example) rather
>>>>>>> than
>>>>>>> the framework. The dx tool needs to have classes that were compiled with
>>>>>>> a
>>>>>>> "new" compiler (i.e. greater than 1.5).
>>>>>> 
>>>>>> Since when? Always worked for me. Again, the framework itself is
>>>>>> compiled for 1.3...
>>>>>> 
>>>>>> regards,
>>>>>> 
>>>>>> Karl
>>>>>> 
>>>>>>> Thanks
>>>>>>> 
>>>>>>> Bruce
>>>>>>> 
>>>>>>> 
>>>>>>> On 12/02/2010 13:33, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>>>> 
>>>>>>>> Why would you need 1.5 to be able to dex the bundle (the framework
>>>>>>>> itself is build for 1.3 btw.)?
>>>>>>>> 
>>>>>>>> regards,
>>>>>>>> 
>>>>>>>> Karl
>>>>>>>> 
>>>>>>>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>>>>> wrote:
>>>>>>>>> Hi Pablo
>>>>>>>>> 
>>>>>>>>> See the attached code. The biggest problem I've encountered is that the
>>>>>>>>> Felix distribution is a huge pain to build under JDK 1.5, and therefore
>>>>>>>>> to
>>>>>>>>> be able to use some of the bundles (for example the http service) that
>>>>>>>>> are
>>>>>>>>> part of the distribution. Its not a simple job of just changing a
>>>>>>>>> couple
>>>>>>>>> of
>>>>>>>>> entries in POM files: some components download pre-built JAR files from
>>>>>>>>> the
>>>>>>>>> web and explode these, thereby having classes built under 1.4 which
>>>>>>>>> will
>>>>>>>>> not
>>>>>>>>> work when you dexify the bundles.
>>>>>>>>> 
>>>>>>>>> This is something that would be great to see some work done on by the
>>>>>>>>> Felix
>>>>>>>>> community, because while its true that the basic Felix core does and
>>>>>>>>> will
>>>>>>>>> support Android, most of the add-on bundles wont.
>>>>>>>>> 
>>>>>>>>> For my part, the ideal solution would be to see the whole framework be
>>>>>>>>> based
>>>>>>>>> on JDK 1.5 and not 1.4.
>>>>>>>>> 
>>>>>>>>> Thanks
>>>>>>>>> 
>>>>>>>>> Bruce
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>>>>>>>>> Do you have some advance?
>>>>>>>>>> Salutations, thanks.
>>>>>>>>>> Pablo.
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> Jackson, Bruce wrote:
>>>>>>>>>>> 
>>>>>>>>>>> The Felix site has a useful section on getting things going on
>>>>>>>>>>> Android >>>>>>>> (
>>>>>>>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html)
>>>>>>>>>>> but
>>>>>>>>>>> isn't
>>>>>>>>>>> so clear about embedding the framework into an Android app"
>>>>>>>>>>> 
>>>>>>>>>>> "Apache Felix can also be integrated with an Android application. To
>>>>>>>>>>> achieve
>>>>>>>>>>> this, you need to embed Felix into onCreate() method of your Activity
>>>>>>>>>>> class
>>>>>>>>>>> (see Android docs for more details on how to use an Activity) and
>>>>>>>>>>> process
>>>>>>>>>>> your bundles as shown above."
>>>>>>>>>>> 
>>>>>>>>>>> Has anyone got an example of how you do this? I understand how to
>>>>>>>>>>> write
>>>>>>>>>>> the
>>>>>>>>>>> Android app, and I get the point being made here. What I need to
>>>>>>>>>>> understand
>>>>>>>>>>> is:
>>>>>>>>>>> 
>>>>>>>>>>> 1. How do you launch the Felix framework. What do I need to
>>>>>>>>>>> instantiate?
>>>>>>>>>>> 2. Where does the framework get its boot configuration (i.e. what
>>>>>>>>>>> bundles
>>>>>>>>>>> to
>>>>>>>>>>> load, run levels, environment variables, etc) from in this case?
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>> 
>> 
> 


Re: Felix on Android

Posted by "Jackson, Bruce" <br...@qualcomm.com>.
Clement, when you say 'I use the HTTP Service 1.0.0. Could you try with that
one ?' which one do you mean?

Thanks
Bruce


On 12/02/2010 18:57, "Clement Escoffier" <cl...@gmail.com>
wrote:

> 
> On 12.02.2010, at 17:27, Jackson, Bruce wrote:
> 
>> I've got the Felix framework installed on my Nexus. If I download the
>> org.apache.felix.http.jetty-2.0.4.jar bundle from the Felix site, dx it
>> (which generates piles of warnings) push it to the phone, start Felix and
>> then install the jetty bundle, Felix just hangs:
>> 
>> -> ps
>> START LEVEL 1
>>   ID   State         Level  Name
>> [   0] [Active     ] [    0] System Bundle (1.4.0)
>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
>> [   3] [Active     ] [    1] JDOM (1.0.0.v200803070505)
>> -> install file:bundle/org.apache.felix.http.jetty-2.0.4.jar
>> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>> better to be explicit if an 8k-char buffer is required.
>> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>> better to be explicit if an 8k-char buffer is required.
>> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>> better to be explicit if an 8k-char buffer is required.
>> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>> better to be explicit if an 8k-char buffer is required.
>> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>> better to be explicit if an 8k-char buffer is required.
>> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>> better to be explicit if an 8k-char buffer is required.
>> Bundle ID: 5
>> -> ps
>> START LEVEL 1
>>   ID   State         Level  Name
>> [   0] [Active     ] [    0] System Bundle (1.4.0)
>> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
>> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
>> [   3] [Active     ] [    1] JDOM (1.0.0.v200803070505)
>> [   5] [Installed  ] [    1] Apache Felix Http Jetty (2.0.4)
>> -> start 5
>> Feb 12, 2010 4:15:08 PM java.io.BufferedWriter <init>
>> INFO: Default buffer size used in BufferedWriter constructor. It would be
>> better to be explicit if an 8k-char buffer is required.
>> DEBUG: WIRE: 5.0 -> javax.xml.parsers -> 0
>> DEBUG: WIRE: 5.0 -> org.xml.sax -> 0
>> DEBUG: WIRE: 5.0 -> javax.servlet.resources -> 5.0
>> DEBUG: WIRE: 5.0 -> javax.servlet -> 5.0
>> DEBUG: WIRE: 5.0 -> javax.security.cert -> 0
>> DEBUG: WIRE: 5.0 -> org.osgi.util.tracker -> 0
>> DEBUG: WIRE: 5.0 -> org.osgi.framework -> 0
>> DEBUG: WIRE: 5.0 -> javax.servlet.jsp.resources -> 5.0
>> DEBUG: WIRE: 5.0 -> javax.net.ssl -> 0
>> DEBUG: WIRE: 5.0 -> org.xml.sax.helpers -> 0
>> DEBUG: WIRE: 5.0 -> org.osgi.service.http -> 5.0
>> DEBUG: WIRE: 5.0 -> org.apache.felix.http.api -> 5.0
>> DEBUG: WIRE: 5.0 -> javax.servlet.http -> 5.0
>> 
>> At this point, I have to CTRL-C to kill Felix. The same thing happened before
>> I compiled JDOM with 1.5+. I might be missing something, but my assumption,
>> perhaps wrong, was that it was the compiler version that was causing this
>> behavior?
> 
> Hum interesting,
> 
> Potentially this is very slow, or there is an issue with the NIO.
> I use the HTTP Service 1.0.0. Could you try with that one ?
> 
> 
> Clement
> 
>> 
>> Thanks
>> 
>> Bruce
>> 
>> 
>> 
>> 
>> 
>> 
>> On 12/02/2010 15:51, "Clement Escoffier" <cl...@gmail.com> wrote:
>> 
>>> 
>>> On 12.02.2010, at 16:45, Jackson, Bruce wrote:
>>> 
>>>> Whenever you dx a bundle which has been built with a pre-1.5 compiler you
>>>> will usually get a pile of:
>>>> 
>>>> warning: Ignoring InnerClasses attribute for an anonymous inner class that
>>>> doesn't come with an associated EnclosingMethod attribute. (This class was
>>>> probably produced by a broken compiler.)
>>>> 
>>>> ...messages (assuming that you do use inner classes in the bundle). These
>>>> are generated because the bundle was compiled with a pre-1.5 compiler. With
>>>> something like the org.jdom bundle, the bundle will not work correctly if
>>>> it
>>>> was compiled with a pre-1.5 compiler and then dx-ed, while using a post-1.5
>>>> it does.
>>>> 
>>>> It may a be a broad assessment of the situation, but I took this experience
>>>> to indicate that it was required to build bundles with a post-1.5 compiler.
>>>> Indeed if you look around the web, you'll see this warning mentioned in
>>>> relation to a number of problems people are having with getting apps
>>>> running
>>>> on Android, when using JARs that were compiled pre-1.5.
>>> 
>>> Well, you got less messages if you compile with 1.5+, but that's does say
>>> that
>>> a bundle will not work.
>>> When dexifying iPOJO, I have a couple of message too, but the complete iPOJO
>>> test suite works on Android (except some features using on the fly bytecode
>>> generation).
>>> 
>>> Regards,
>>> 
>>> Clement
>>> 
>>> 
>>> 
>>>> 
>>>> Thanks
>>>> 
>>>> Bruce
>>>> 
>>>> On 12/02/2010 15:25, "Karl Pauls" <ka...@gmail.com> wrote:
>>>> 
>>>>> On Fri, Feb 12, 2010 at 4:22 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>> wrote:
>>>>>> I'm taking here about the ad-on bundles (like http, for example) rather
>>>>>> than
>>>>>> the framework. The dx tool needs to have classes that were compiled with
>>>>>> a
>>>>>> "new" compiler (i.e. greater than 1.5).
>>>>> 
>>>>> Since when? Always worked for me. Again, the framework itself is
>>>>> compiled for 1.3...
>>>>> 
>>>>> regards,
>>>>> 
>>>>> Karl
>>>>> 
>>>>>> Thanks
>>>>>> 
>>>>>> Bruce
>>>>>> 
>>>>>> 
>>>>>> On 12/02/2010 13:33, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>>> 
>>>>>>> Why would you need 1.5 to be able to dex the bundle (the framework
>>>>>>> itself is build for 1.3 btw.)?
>>>>>>> 
>>>>>>> regards,
>>>>>>> 
>>>>>>> Karl
>>>>>>> 
>>>>>>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>>>> wrote:
>>>>>>>> Hi Pablo
>>>>>>>> 
>>>>>>>> See the attached code. The biggest problem I've encountered is that the
>>>>>>>> Felix distribution is a huge pain to build under JDK 1.5, and therefore
>>>>>>>> to
>>>>>>>> be able to use some of the bundles (for example the http service) that
>>>>>>>> are
>>>>>>>> part of the distribution. Its not a simple job of just changing a
>>>>>>>> couple
>>>>>>>> of
>>>>>>>> entries in POM files: some components download pre-built JAR files from
>>>>>>>> the
>>>>>>>> web and explode these, thereby having classes built under 1.4 which
>>>>>>>> will
>>>>>>>> not
>>>>>>>> work when you dexify the bundles.
>>>>>>>> 
>>>>>>>> This is something that would be great to see some work done on by the
>>>>>>>> Felix
>>>>>>>> community, because while its true that the basic Felix core does and
>>>>>>>> will
>>>>>>>> support Android, most of the add-on bundles wont.
>>>>>>>> 
>>>>>>>> For my part, the ideal solution would be to see the whole framework be
>>>>>>>> based
>>>>>>>> on JDK 1.5 and not 1.4.
>>>>>>>> 
>>>>>>>> Thanks
>>>>>>>> 
>>>>>>>> Bruce
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>>>>>>>> Do you have some advance?
>>>>>>>>> Salutations, thanks.
>>>>>>>>> Pablo.
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Jackson, Bruce wrote:
>>>>>>>>>> 
>>>>>>>>>> The Felix site has a useful section on getting things going on
>>>>>>>>>> Android >>>>>>>> (
>>>>>>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html)
>>>>>>>>>> but
>>>>>>>>>> isn't
>>>>>>>>>> so clear about embedding the framework into an Android app"
>>>>>>>>>> 
>>>>>>>>>> "Apache Felix can also be integrated with an Android application. To
>>>>>>>>>> achieve
>>>>>>>>>> this, you need to embed Felix into onCreate() method of your Activity
>>>>>>>>>> class
>>>>>>>>>> (see Android docs for more details on how to use an Activity) and
>>>>>>>>>> process
>>>>>>>>>> your bundles as shown above."
>>>>>>>>>> 
>>>>>>>>>> Has anyone got an example of how you do this? I understand how to
>>>>>>>>>> write
>>>>>>>>>> the
>>>>>>>>>> Android app, and I get the point being made here. What I need to
>>>>>>>>>> understand
>>>>>>>>>> is:
>>>>>>>>>> 
>>>>>>>>>> 1. How do you launch the Felix framework. What do I need to
>>>>>>>>>> instantiate?
>>>>>>>>>> 2. Where does the framework get its boot configuration (i.e. what
>>>>>>>>>> bundles
>>>>>>>>>> to
>>>>>>>>>> load, run levels, environment variables, etc) from in this case?
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>> 
>>> 
> 


Re: Felix on Android

Posted by Clement Escoffier <cl...@gmail.com>.
On 12.02.2010, at 17:27, Jackson, Bruce wrote:

> I've got the Felix framework installed on my Nexus. If I download the org.apache.felix.http.jetty-2.0.4.jar bundle from the Felix site, dx it (which generates piles of warnings) push it to the phone, start Felix and then install the jetty bundle, Felix just hangs:
> 
> -> ps
> START LEVEL 1
>   ID   State         Level  Name
> [   0] [Active     ] [    0] System Bundle (1.4.0)
> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
> [   3] [Active     ] [    1] JDOM (1.0.0.v200803070505)
> -> install file:bundle/org.apache.felix.http.jetty-2.0.4.jar
> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
> INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
> INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
> Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
> INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
> INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
> INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
> Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
> INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
> Bundle ID: 5
> -> ps
> START LEVEL 1
>   ID   State         Level  Name
> [   0] [Active     ] [    0] System Bundle (1.4.0)
> [   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
> [   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
> [   3] [Active     ] [    1] JDOM (1.0.0.v200803070505)
> [   5] [Installed  ] [    1] Apache Felix Http Jetty (2.0.4)
> -> start 5
> Feb 12, 2010 4:15:08 PM java.io.BufferedWriter <init>
> INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
> DEBUG: WIRE: 5.0 -> javax.xml.parsers -> 0
> DEBUG: WIRE: 5.0 -> org.xml.sax -> 0
> DEBUG: WIRE: 5.0 -> javax.servlet.resources -> 5.0
> DEBUG: WIRE: 5.0 -> javax.servlet -> 5.0
> DEBUG: WIRE: 5.0 -> javax.security.cert -> 0
> DEBUG: WIRE: 5.0 -> org.osgi.util.tracker -> 0
> DEBUG: WIRE: 5.0 -> org.osgi.framework -> 0
> DEBUG: WIRE: 5.0 -> javax.servlet.jsp.resources -> 5.0
> DEBUG: WIRE: 5.0 -> javax.net.ssl -> 0
> DEBUG: WIRE: 5.0 -> org.xml.sax.helpers -> 0
> DEBUG: WIRE: 5.0 -> org.osgi.service.http -> 5.0
> DEBUG: WIRE: 5.0 -> org.apache.felix.http.api -> 5.0
> DEBUG: WIRE: 5.0 -> javax.servlet.http -> 5.0
> 
> At this point, I have to CTRL-C to kill Felix. The same thing happened before I compiled JDOM with 1.5+. I might be missing something, but my assumption, perhaps wrong, was that it was the compiler version that was causing this behavior?

Hum interesting,

Potentially this is very slow, or there is an issue with the NIO. 
I use the HTTP Service 1.0.0. Could you try with that one ?


Clement

> 
> Thanks
> 
> Bruce
> 
> 
> 
> 
> 
> 
> On 12/02/2010 15:51, "Clement Escoffier" <cl...@gmail.com> wrote:
> 
>> 
>> On 12.02.2010, at 16:45, Jackson, Bruce wrote:
>> 
>>> Whenever you dx a bundle which has been built with a pre-1.5 compiler you
>>> will usually get a pile of:
>>> 
>>> warning: Ignoring InnerClasses attribute for an anonymous inner class that
>>> doesn't come with an associated EnclosingMethod attribute. (This class was
>>> probably produced by a broken compiler.)
>>> 
>>> ...messages (assuming that you do use inner classes in the bundle). These
>>> are generated because the bundle was compiled with a pre-1.5 compiler. With
>>> something like the org.jdom bundle, the bundle will not work correctly if it
>>> was compiled with a pre-1.5 compiler and then dx-ed, while using a post-1.5
>>> it does.
>>> 
>>> It may a be a broad assessment of the situation, but I took this experience
>>> to indicate that it was required to build bundles with a post-1.5 compiler.
>>> Indeed if you look around the web, you'll see this warning mentioned in
>>> relation to a number of problems people are having with getting apps running
>>> on Android, when using JARs that were compiled pre-1.5.
>> 
>> Well, you got less messages if you compile with 1.5+, but that's does say that
>> a bundle will not work.
>> When dexifying iPOJO, I have a couple of message too, but the complete iPOJO
>> test suite works on Android (except some features using on the fly bytecode
>> generation).
>> 
>> Regards,
>> 
>> Clement
>> 
>> 
>> 
>>> 
>>> Thanks
>>> 
>>> Bruce
>>> 
>>> On 12/02/2010 15:25, "Karl Pauls" <ka...@gmail.com> wrote:
>>> 
>>>> On Fri, Feb 12, 2010 at 4:22 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>>>>> I'm taking here about the ad-on bundles (like http, for example) rather
>>>>> than
>>>>> the framework. The dx tool needs to have classes that were compiled with a
>>>>> "new" compiler (i.e. greater than 1.5).
>>>> 
>>>> Since when? Always worked for me. Again, the framework itself is
>>>> compiled for 1.3...
>>>> 
>>>> regards,
>>>> 
>>>> Karl
>>>> 
>>>>> Thanks
>>>>> 
>>>>> Bruce
>>>>> 
>>>>> 
>>>>> On 12/02/2010 13:33, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>> 
>>>>>> Why would you need 1.5 to be able to dex the bundle (the framework
>>>>>> itself is build for 1.3 btw.)?
>>>>>> 
>>>>>> regards,
>>>>>> 
>>>>>> Karl
>>>>>> 
>>>>>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>>> wrote:
>>>>>>> Hi Pablo
>>>>>>> 
>>>>>>> See the attached code. The biggest problem I've encountered is that the
>>>>>>> Felix distribution is a huge pain to build under JDK 1.5, and therefore
>>>>>>> to
>>>>>>> be able to use some of the bundles (for example the http service) that
>>>>>>> are
>>>>>>> part of the distribution. Its not a simple job of just changing a couple
>>>>>>> of
>>>>>>> entries in POM files: some components download pre-built JAR files from
>>>>>>> the
>>>>>>> web and explode these, thereby having classes built under 1.4 which will
>>>>>>> not
>>>>>>> work when you dexify the bundles.
>>>>>>> 
>>>>>>> This is something that would be great to see some work done on by the
>>>>>>> Felix
>>>>>>> community, because while its true that the basic Felix core does and will
>>>>>>> support Android, most of the add-on bundles wont.
>>>>>>> 
>>>>>>> For my part, the ideal solution would be to see the whole framework be
>>>>>>> based
>>>>>>> on JDK 1.5 and not 1.4.
>>>>>>> 
>>>>>>> Thanks
>>>>>>> 
>>>>>>> Bruce
>>>>>>> 
>>>>>>> 
>>>>>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>>>>>> 
>>>>>>>> 
>>>>>>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>>>>>>> Do you have some advance?
>>>>>>>> Salutations, thanks.
>>>>>>>> Pablo.
>>>>>>>> 
>>>>>>>> 
>>>>>>>> Jackson, Bruce wrote:
>>>>>>>>> 
>>>>>>>>> The Felix site has a useful section on getting things going on Android >>>>>>>> (
>>>>>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html) but
>>>>>>>>> isn't
>>>>>>>>> so clear about embedding the framework into an Android app"
>>>>>>>>> 
>>>>>>>>> "Apache Felix can also be integrated with an Android application. To
>>>>>>>>> achieve
>>>>>>>>> this, you need to embed Felix into onCreate() method of your Activity
>>>>>>>>> class
>>>>>>>>> (see Android docs for more details on how to use an Activity) and
>>>>>>>>> process
>>>>>>>>> your bundles as shown above."
>>>>>>>>> 
>>>>>>>>> Has anyone got an example of how you do this? I understand how to write
>>>>>>>>> the
>>>>>>>>> Android app, and I get the point being made here. What I need to
>>>>>>>>> understand
>>>>>>>>> is:
>>>>>>>>> 
>>>>>>>>> 1. How do you launch the Felix framework. What do I need to
>>>>>>>>> instantiate?
>>>>>>>>> 2. Where does the framework get its boot configuration (i.e. what
>>>>>>>>> bundles
>>>>>>>>> to
>>>>>>>>> load, run levels, environment variables, etc) from in this case?
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> 
>>> 
>> 


Re: Felix on Android

Posted by "Jackson, Bruce" <br...@qualcomm.com>.
I've got the Felix framework installed on my Nexus. If I download the org.apache.felix.http.jetty-2.0.4.jar bundle from the Felix site, dx it (which generates piles of warnings) push it to the phone, start Felix and then install the jetty bundle, Felix just hangs:

-> ps
START LEVEL 1
   ID   State         Level  Name
[   0] [Active     ] [    0] System Bundle (1.4.0)
[   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
[   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
[   3] [Active     ] [    1] JDOM (1.0.0.v200803070505)
-> install file:bundle/org.apache.felix.http.jetty-2.0.4.jar
Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 12, 2010 4:15:03 PM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
Feb 12, 2010 4:15:04 PM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
Bundle ID: 5
-> ps
START LEVEL 1
   ID   State         Level  Name
[   0] [Active     ] [    0] System Bundle (1.4.0)
[   1] [Active     ] [    1] Apache Felix Shell Service (1.0.2)
[   2] [Active     ] [    1] Apache Felix Shell TUI (1.0.2)
[   3] [Active     ] [    1] JDOM (1.0.0.v200803070505)
[   5] [Installed  ] [    1] Apache Felix Http Jetty (2.0.4)
-> start 5
Feb 12, 2010 4:15:08 PM java.io.BufferedWriter <init>
INFO: Default buffer size used in BufferedWriter constructor. It would be better to be explicit if an 8k-char buffer is required.
DEBUG: WIRE: 5.0 -> javax.xml.parsers -> 0
DEBUG: WIRE: 5.0 -> org.xml.sax -> 0
DEBUG: WIRE: 5.0 -> javax.servlet.resources -> 5.0
DEBUG: WIRE: 5.0 -> javax.servlet -> 5.0
DEBUG: WIRE: 5.0 -> javax.security.cert -> 0
DEBUG: WIRE: 5.0 -> org.osgi.util.tracker -> 0
DEBUG: WIRE: 5.0 -> org.osgi.framework -> 0
DEBUG: WIRE: 5.0 -> javax.servlet.jsp.resources -> 5.0
DEBUG: WIRE: 5.0 -> javax.net.ssl -> 0
DEBUG: WIRE: 5.0 -> org.xml.sax.helpers -> 0
DEBUG: WIRE: 5.0 -> org.osgi.service.http -> 5.0
DEBUG: WIRE: 5.0 -> org.apache.felix.http.api -> 5.0
DEBUG: WIRE: 5.0 -> javax.servlet.http -> 5.0

At this point, I have to CTRL-C to kill Felix. The same thing happened before I compiled JDOM with 1.5+. I might be missing something, but my assumption, perhaps wrong, was that it was the compiler version that was causing this behavior?

Thanks

Bruce






On 12/02/2010 15:51, "Clement Escoffier" <cl...@gmail.com> wrote:

>
> On 12.02.2010, at 16:45, Jackson, Bruce wrote:
>
>> Whenever you dx a bundle which has been built with a pre-1.5 compiler you
>> will usually get a pile of:
>>
>> warning: Ignoring InnerClasses attribute for an anonymous inner class that
>> doesn't come with an associated EnclosingMethod attribute. (This class was
>> probably produced by a broken compiler.)
>>
>> ...messages (assuming that you do use inner classes in the bundle). These
>> are generated because the bundle was compiled with a pre-1.5 compiler. With
>> something like the org.jdom bundle, the bundle will not work correctly if it
>> was compiled with a pre-1.5 compiler and then dx-ed, while using a post-1.5
>> it does.
>>
>> It may a be a broad assessment of the situation, but I took this experience
>> to indicate that it was required to build bundles with a post-1.5 compiler.
>> Indeed if you look around the web, you'll see this warning mentioned in
>> relation to a number of problems people are having with getting apps running
>> on Android, when using JARs that were compiled pre-1.5.
>
> Well, you got less messages if you compile with 1.5+, but that's does say that
> a bundle will not work.
> When dexifying iPOJO, I have a couple of message too, but the complete iPOJO
> test suite works on Android (except some features using on the fly bytecode
> generation).
>
> Regards,
>
> Clement
>
>
>
>>
>> Thanks
>>
>> Bruce
>>
>> On 12/02/2010 15:25, "Karl Pauls" <ka...@gmail.com> wrote:
>>
>>> On Fri, Feb 12, 2010 at 4:22 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>>>> I'm taking here about the ad-on bundles (like http, for example) rather
>>>> than
>>>> the framework. The dx tool needs to have classes that were compiled with a
>>>> "new" compiler (i.e. greater than 1.5).
>>>
>>> Since when? Always worked for me. Again, the framework itself is
>>> compiled for 1.3...
>>>
>>> regards,
>>>
>>> Karl
>>>
>>>> Thanks
>>>>
>>>> Bruce
>>>>
>>>>
>>>> On 12/02/2010 13:33, "Karl Pauls" <ka...@gmail.com> wrote:
>>>>
>>>>> Why would you need 1.5 to be able to dex the bundle (the framework
>>>>> itself is build for 1.3 btw.)?
>>>>>
>>>>> regards,
>>>>>
>>>>> Karl
>>>>>
>>>>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>> wrote:
>>>>>> Hi Pablo
>>>>>>
>>>>>> See the attached code. The biggest problem I've encountered is that the
>>>>>> Felix distribution is a huge pain to build under JDK 1.5, and therefore
>>>>>> to
>>>>>> be able to use some of the bundles (for example the http service) that
>>>>>> are
>>>>>> part of the distribution. Its not a simple job of just changing a couple
>>>>>> of
>>>>>> entries in POM files: some components download pre-built JAR files from
>>>>>> the
>>>>>> web and explode these, thereby having classes built under 1.4 which will
>>>>>> not
>>>>>> work when you dexify the bundles.
>>>>>>
>>>>>> This is something that would be great to see some work done on by the
>>>>>> Felix
>>>>>> community, because while its true that the basic Felix core does and will
>>>>>> support Android, most of the add-on bundles wont.
>>>>>>
>>>>>> For my part, the ideal solution would be to see the whole framework be
>>>>>> based
>>>>>> on JDK 1.5 and not 1.4.
>>>>>>
>>>>>> Thanks
>>>>>>
>>>>>> Bruce
>>>>>>
>>>>>>
>>>>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>>>>>
>>>>>>>
>>>>>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>>>>>> Do you have some advance?
>>>>>>> Salutations, thanks.
>>>>>>> Pablo.
>>>>>>>
>>>>>>>
>>>>>>> Jackson, Bruce wrote:
>>>>>>>>
>>>>>>>> The Felix site has a useful section on getting things going on Android >>>>>>>> (
>>>>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html) but
>>>>>>>> isn't
>>>>>>>> so clear about embedding the framework into an Android app"
>>>>>>>>
>>>>>>>> "Apache Felix can also be integrated with an Android application. To
>>>>>>>> achieve
>>>>>>>> this, you need to embed Felix into onCreate() method of your Activity
>>>>>>>> class
>>>>>>>> (see Android docs for more details on how to use an Activity) and
>>>>>>>> process
>>>>>>>> your bundles as shown above."
>>>>>>>>
>>>>>>>> Has anyone got an example of how you do this? I understand how to write
>>>>>>>> the
>>>>>>>> Android app, and I get the point being made here. What I need to
>>>>>>>> understand
>>>>>>>> is:
>>>>>>>>
>>>>>>>> 1. How do you launch the Felix framework. What do I need to
>>>>>>>> instantiate?
>>>>>>>> 2. Where does the framework get its boot configuration (i.e. what
>>>>>>>> bundles
>>>>>>>> to
>>>>>>>> load, run levels, environment variables, etc) from in this case?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>
>>>
>>
>

Re: Felix on Android

Posted by Clement Escoffier <cl...@gmail.com>.
On 12.02.2010, at 16:45, Jackson, Bruce wrote:

> Whenever you dx a bundle which has been built with a pre-1.5 compiler you
> will usually get a pile of:
> 
> warning: Ignoring InnerClasses attribute for an anonymous inner class that
> doesn't come with an associated EnclosingMethod attribute. (This class was
> probably produced by a broken compiler.)
> 
> ...messages (assuming that you do use inner classes in the bundle). These
> are generated because the bundle was compiled with a pre-1.5 compiler. With
> something like the org.jdom bundle, the bundle will not work correctly if it
> was compiled with a pre-1.5 compiler and then dx-ed, while using a post-1.5
> it does.
> 
> It may a be a broad assessment of the situation, but I took this experience
> to indicate that it was required to build bundles with a post-1.5 compiler.
> Indeed if you look around the web, you'll see this warning mentioned in
> relation to a number of problems people are having with getting apps running
> on Android, when using JARs that were compiled pre-1.5.

Well, you got less messages if you compile with 1.5+, but that's does say that a bundle will not work.
When dexifying iPOJO, I have a couple of message too, but the complete iPOJO test suite works on Android (except some features using on the fly bytecode generation). 

Regards,

Clement



> 
> Thanks
> 
> Bruce
> 
> On 12/02/2010 15:25, "Karl Pauls" <ka...@gmail.com> wrote:
> 
>> On Fri, Feb 12, 2010 at 4:22 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>>> I'm taking here about the ad-on bundles (like http, for example) rather than
>>> the framework. The dx tool needs to have classes that were compiled with a
>>> "new" compiler (i.e. greater than 1.5).
>> 
>> Since when? Always worked for me. Again, the framework itself is
>> compiled for 1.3...
>> 
>> regards,
>> 
>> Karl
>> 
>>> Thanks
>>> 
>>> Bruce
>>> 
>>> 
>>> On 12/02/2010 13:33, "Karl Pauls" <ka...@gmail.com> wrote:
>>> 
>>>> Why would you need 1.5 to be able to dex the bundle (the framework
>>>> itself is build for 1.3 btw.)?
>>>> 
>>>> regards,
>>>> 
>>>> Karl
>>>> 
>>>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>>>>> Hi Pablo
>>>>> 
>>>>> See the attached code. The biggest problem I've encountered is that the
>>>>> Felix distribution is a huge pain to build under JDK 1.5, and therefore to
>>>>> be able to use some of the bundles (for example the http service) that are
>>>>> part of the distribution. Its not a simple job of just changing a couple of
>>>>> entries in POM files: some components download pre-built JAR files from the
>>>>> web and explode these, thereby having classes built under 1.4 which will
>>>>> not
>>>>> work when you dexify the bundles.
>>>>> 
>>>>> This is something that would be great to see some work done on by the Felix
>>>>> community, because while its true that the basic Felix core does and will
>>>>> support Android, most of the add-on bundles wont.
>>>>> 
>>>>> For my part, the ideal solution would be to see the whole framework be
>>>>> based
>>>>> on JDK 1.5 and not 1.4.
>>>>> 
>>>>> Thanks
>>>>> 
>>>>> Bruce
>>>>> 
>>>>> 
>>>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>>>> 
>>>>>> 
>>>>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>>>>> Do you have some advance?
>>>>>> Salutations, thanks.
>>>>>> Pablo.
>>>>>> 
>>>>>> 
>>>>>> Jackson, Bruce wrote:
>>>>>>> 
>>>>>>> The Felix site has a useful section on getting things going on Android (
>>>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html) but
>>>>>>> isn't
>>>>>>> so clear about embedding the framework into an Android app"
>>>>>>> 
>>>>>>> "Apache Felix can also be integrated with an Android application. To
>>>>>>> achieve
>>>>>>> this, you need to embed Felix into onCreate() method of your Activity
>>>>>>> class
>>>>>>> (see Android docs for more details on how to use an Activity) and process
>>>>>>> your bundles as shown above."
>>>>>>> 
>>>>>>> Has anyone got an example of how you do this? I understand how to write
>>>>>>> the
>>>>>>> Android app, and I get the point being made here. What I need to
>>>>>>> understand
>>>>>>> is:
>>>>>>> 
>>>>>>> 1. How do you launch the Felix framework. What do I need to instantiate?
>>>>>>> 2. Where does the framework get its boot configuration (i.e. what bundles
>>>>>>> to
>>>>>>> load, run levels, environment variables, etc) from in this case?
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 


Re: Felix on Android

Posted by "Jackson, Bruce" <br...@qualcomm.com>.
Whenever you dx a bundle which has been built with a pre-1.5 compiler you
will usually get a pile of:

warning: Ignoring InnerClasses attribute for an anonymous inner class that
doesn't come with an associated EnclosingMethod attribute. (This class was
probably produced by a broken compiler.)

...messages (assuming that you do use inner classes in the bundle). These
are generated because the bundle was compiled with a pre-1.5 compiler. With
something like the org.jdom bundle, the bundle will not work correctly if it
was compiled with a pre-1.5 compiler and then dx-ed, while using a post-1.5
it does.

It may a be a broad assessment of the situation, but I took this experience
to indicate that it was required to build bundles with a post-1.5 compiler.
Indeed if you look around the web, you'll see this warning mentioned in
relation to a number of problems people are having with getting apps running
on Android, when using JARs that were compiled pre-1.5.

Thanks

Bruce

On 12/02/2010 15:25, "Karl Pauls" <ka...@gmail.com> wrote:

> On Fri, Feb 12, 2010 at 4:22 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>> I'm taking here about the ad-on bundles (like http, for example) rather than
>> the framework. The dx tool needs to have classes that were compiled with a
>> "new" compiler (i.e. greater than 1.5).
> 
> Since when? Always worked for me. Again, the framework itself is
> compiled for 1.3...
> 
> regards,
> 
> Karl
> 
>> Thanks
>> 
>> Bruce
>> 
>> 
>> On 12/02/2010 13:33, "Karl Pauls" <ka...@gmail.com> wrote:
>> 
>>> Why would you need 1.5 to be able to dex the bundle (the framework
>>> itself is build for 1.3 btw.)?
>>> 
>>> regards,
>>> 
>>> Karl
>>> 
>>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>>>> Hi Pablo
>>>> 
>>>> See the attached code. The biggest problem I've encountered is that the
>>>> Felix distribution is a huge pain to build under JDK 1.5, and therefore to
>>>> be able to use some of the bundles (for example the http service) that are
>>>> part of the distribution. Its not a simple job of just changing a couple of
>>>> entries in POM files: some components download pre-built JAR files from the
>>>> web and explode these, thereby having classes built under 1.4 which will
>>>> not
>>>> work when you dexify the bundles.
>>>> 
>>>> This is something that would be great to see some work done on by the Felix
>>>> community, because while its true that the basic Felix core does and will
>>>> support Android, most of the add-on bundles wont.
>>>> 
>>>> For my part, the ideal solution would be to see the whole framework be
>>>> based
>>>> on JDK 1.5 and not 1.4.
>>>> 
>>>> Thanks
>>>> 
>>>> Bruce
>>>> 
>>>> 
>>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>>> 
>>>>> 
>>>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>>>> Do you have some advance?
>>>>> Salutations, thanks.
>>>>> Pablo.
>>>>> 
>>>>> 
>>>>> Jackson, Bruce wrote:
>>>>>> 
>>>>>> The Felix site has a useful section on getting things going on Android (
>>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html) but
>>>>>> isn't
>>>>>> so clear about embedding the framework into an Android app"
>>>>>> 
>>>>>> "Apache Felix can also be integrated with an Android application. To
>>>>>> achieve
>>>>>> this, you need to embed Felix into onCreate() method of your Activity
>>>>>> class
>>>>>> (see Android docs for more details on how to use an Activity) and process
>>>>>> your bundles as shown above."
>>>>>> 
>>>>>> Has anyone got an example of how you do this? I understand how to write
>>>>>> the
>>>>>> Android app, and I get the point being made here. What I need to
>>>>>> understand
>>>>>> is:
>>>>>> 
>>>>>> 1. How do you launch the Felix framework. What do I need to instantiate?
>>>>>> 2. Where does the framework get its boot configuration (i.e. what bundles
>>>>>> to
>>>>>> load, run levels, environment variables, etc) from in this case?
>>>>>> 
>>>>>> 
>>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 


Re: Felix on Android

Posted by Karl Pauls <ka...@gmail.com>.
On Fri, Feb 12, 2010 at 4:22 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
> I'm taking here about the ad-on bundles (like http, for example) rather than
> the framework. The dx tool needs to have classes that were compiled with a
> "new" compiler (i.e. greater than 1.5).

Since when? Always worked for me. Again, the framework itself is
compiled for 1.3...

regards,

Karl

> Thanks
>
> Bruce
>
>
> On 12/02/2010 13:33, "Karl Pauls" <ka...@gmail.com> wrote:
>
>> Why would you need 1.5 to be able to dex the bundle (the framework
>> itself is build for 1.3 btw.)?
>>
>> regards,
>>
>> Karl
>>
>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>>> Hi Pablo
>>>
>>> See the attached code. The biggest problem I've encountered is that the
>>> Felix distribution is a huge pain to build under JDK 1.5, and therefore to
>>> be able to use some of the bundles (for example the http service) that are
>>> part of the distribution. Its not a simple job of just changing a couple of
>>> entries in POM files: some components download pre-built JAR files from the
>>> web and explode these, thereby having classes built under 1.4 which will not
>>> work when you dexify the bundles.
>>>
>>> This is something that would be great to see some work done on by the Felix
>>> community, because while its true that the basic Felix core does and will
>>> support Android, most of the add-on bundles wont.
>>>
>>> For my part, the ideal solution would be to see the whole framework be based
>>> on JDK 1.5 and not 1.4.
>>>
>>> Thanks
>>>
>>> Bruce
>>>
>>>
>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>>
>>>>
>>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>>> Do you have some advance?
>>>> Salutations, thanks.
>>>> Pablo.
>>>>
>>>>
>>>> Jackson, Bruce wrote:
>>>>>
>>>>> The Felix site has a useful section on getting things going on Android (
>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html) but
>>>>> isn't
>>>>> so clear about embedding the framework into an Android app"
>>>>>
>>>>> "Apache Felix can also be integrated with an Android application. To
>>>>> achieve
>>>>> this, you need to embed Felix into onCreate() method of your Activity
>>>>> class
>>>>> (see Android docs for more details on how to use an Activity) and process
>>>>> your bundles as shown above."
>>>>>
>>>>> Has anyone got an example of how you do this? I understand how to write
>>>>> the
>>>>> Android app, and I get the point being made here. What I need to
>>>>> understand
>>>>> is:
>>>>>
>>>>> 1. How do you launch the Felix framework. What do I need to instantiate?
>>>>> 2. Where does the framework get its boot configuration (i.e. what bundles
>>>>> to
>>>>> load, run levels, environment variables, etc) from in this case?
>>>>>
>>>>>
>>>>>
>>>
>>>
>>
>>
>
>



-- 
Karl Pauls
karlpauls@gmail.com

Re: Felix on Android

Posted by "Jackson, Bruce" <br...@qualcomm.com>.
I'm taking here about the ad-on bundles (like http, for example) rather than
the framework. The dx tool needs to have classes that were compiled with a
"new" compiler (i.e. greater than 1.5).

Thanks

Bruce


On 12/02/2010 13:33, "Karl Pauls" <ka...@gmail.com> wrote:

> Why would you need 1.5 to be able to dex the bundle (the framework
> itself is build for 1.3 btw.)?
> 
> regards,
> 
> Karl
> 
> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
>> Hi Pablo
>> 
>> See the attached code. The biggest problem I've encountered is that the
>> Felix distribution is a huge pain to build under JDK 1.5, and therefore to
>> be able to use some of the bundles (for example the http service) that are
>> part of the distribution. Its not a simple job of just changing a couple of
>> entries in POM files: some components download pre-built JAR files from the
>> web and explode these, thereby having classes built under 1.4 which will not
>> work when you dexify the bundles.
>> 
>> This is something that would be great to see some work done on by the Felix
>> community, because while its true that the basic Felix core does and will
>> support Android, most of the add-on bundles wont.
>> 
>> For my part, the ideal solution would be to see the whole framework be based
>> on JDK 1.5 and not 1.4.
>> 
>> Thanks
>> 
>> Bruce
>> 
>> 
>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>> 
>>> 
>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>> Do you have some advance?
>>> Salutations, thanks.
>>> Pablo.
>>> 
>>> 
>>> Jackson, Bruce wrote:
>>>> 
>>>> The Felix site has a useful section on getting things going on Android (
>>>> http://felix.apache.org/site/apache-felix-and-google-android.html) but
>>>> isn't
>>>> so clear about embedding the framework into an Android app"
>>>> 
>>>> "Apache Felix can also be integrated with an Android application. To
>>>> achieve
>>>> this, you need to embed Felix into onCreate() method of your Activity
>>>> class
>>>> (see Android docs for more details on how to use an Activity) and process
>>>> your bundles as shown above."
>>>> 
>>>> Has anyone got an example of how you do this? I understand how to write
>>>> the
>>>> Android app, and I get the point being made here. What I need to
>>>> understand
>>>> is:
>>>> 
>>>> 1. How do you launch the Felix framework. What do I need to instantiate?
>>>> 2. Where does the framework get its boot configuration (i.e. what bundles
>>>> to
>>>> load, run levels, environment variables, etc) from in this case?
>>>> 
>>>> 
>>>> 
>> 
>> 
> 
> 


Re: Felix on Android

Posted by Karl Pauls <ka...@gmail.com>.
On Wed, Feb 24, 2010 at 9:43 AM, Johana <io...@gmail.com> wrote:
>
> I have the exact same problem. I get a NullPointerException when I want to
> extract the service with a specific serviceReference:
>
> ref = bc.getServiceReference(sb[j].toString());
> Log.d("REF", ref.toString());

Well, is it possible that the ref is null? The getServiceReference
method will return null if it can't find the service...

regards,

Karl

> Object service = bc.getService(ref);
>
> It does not even get to the 3rd line of code... Does anybody have an idea
> why? The service appears to be registered.
>
>
>
> pablomj wrote:
>>
>> Well, I learned that the EnglishDictionary.jar bundle it is installed
>> (also Spellchecker and FrenchDictionary) because I obtained all bundles of
>> the bundlecontext of felix.
>> And I extracted the registered services of this bundles with:
>>
>> ServiceReference[] sb=bc.getBundles()[i].getRegisteredServices();
>>
>> Printing with:
>>
>> Log.d("FELIX","registered services: "+sb[j].toString());
>>
>> I obtain:
>> 02-18 17:40:41.818: DEBUG/FELIX(847): registered services:
>> [tutorial.example2.service.DictionaryService]
>>
>> It's a good new. Now...I want instanciate this service ...but I can't
>> instanciate a "DictionaryService" object :(. Some comment? I continue with
>> this, slowly but with energy.
>>
>>
>> Best Regards,
>> Pablo.
>>
>>
>>
>>
>>
>> pablomj wrote:
>>>
>>> Good day, I have good and bad news.
>>>
>>> Firts, Clement thanks, exactly it is need to add in the manifest file the
>>> line:
>>> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
>>> />
>>>
>>> But, it is not enough if you are proving in a emulator. In this case, you
>>> need emulate an sdcard because if you don't make this you will not have
>>> permissions in the sdcard. So, if someday you have this problem, you must
>>> write in console in sdk path/tools:
>>>
>>> mksdcard 64M mySDCard (this creates the sdcard)
>>> android create avd -n nombre -t 4 (this creates an emulator)
>>> emulator -avd nombre -sdcard mySDCard (this launches the emulator with
>>> the sdcard)
>>>
>>> At this moment, you can create and push files in sdcard. Now, in my case
>>> is important don't forget make the push collectionOfJarsFiles in this new
>>> emulator with
>>> adb push C:\EclipseDevelopment\ApacheFelix\Apache_felix_demo\bundle
>>> /data/felix
>>>
>>>
>>> Well, the bad news are that...now I can install a bundle but I think this
>>> is wrong.
>>>
>>> I put here the modified code provided by Bruce:
>>>
>>> void launchFelix()
>>>     {
>>>      Log.d("Felix", "About to start Felix...");
>>>      // Create a configuration property map
>>>      String cacheDir = null;
>>>      try
>>>      {
>>>              cacheDir = File.createTempFile("skifta", ".tmp").getParent();
>>>              }
>>>      catch (IOException e)
>>>      {
>>>                      Log.d("Felix", "unable to create temp file", e);
>>>                      return;
>>>              }
>>>
>>>         Map configMap = new StringMap(false);
>>>         configMap.put("org.osgi.framework.storage", cacheDir);
>>>         configMap.put("felix.embedded.execution", "true");
>>>         configMap.put("org.osgi.service.http.port", "9990");
>>>         configMap.put("org.osgi.framework.startlevel.beginning", "5");
>>>
>>>         try
>>>         {
>>>             // Now create an instance of the framework with
>>>             // our configuration properties.
>>>             m_felix = new Felix(configMap);
>>>             // Now start Felix instance.
>>>             m_felix.start();
>>>             Log.d("Felix", "Felix is started");
>>>
>>>             BundleContext bc=m_felix.getBundleContext();
>>>             bc.installBundle("file:/data/felix/EnglishDictionary.jar");
>>>
>>>             for(org.osgi.framework.Bundle b :
>>> m_felix.getBundleContext().getBundles())
>>>             {
>>>              b.start();
>>>              Log.d("Felix", "Bundle: " + b.getSymbolicName());
>>>             }
>>>         }
>>>         catch (Throwable ex)
>>>         {
>>>             Log.d("Felix","Could not create framework: " +
>>> ex.getMessage(), ex);
>>>         }
>>>     }
>>>
>>>
>>> Well, the install is it made without problems, program don't jumps to the
>>> catch. So, I make install of the EnglishDictionary.jar. But, then, when I
>>> iterate in the for, the b.start() is also made, but I think that I am
>>> doing something wrong because b.getSymbolicName() "null".
>>>
>>> So, what do you think?The bundle is installed?I installed a void bundle?I
>>> made something wrong?
>>>
>>> Salutations and thanks for everyone.
>>> Pablo Muñoz.
>>>
>>>
>>>
>>> clement escoffier wrote:
>>>>
>>>> Hi,
>>>>
>>>>
>>>>
>>>> On 16.02.2010, at 19:20, pablomj wrote:
>>>>
>>>>>
>>>>> Hi everyone, I know what is my current problem.
>>>>>
>>>>> the problem is in this try
>>>>>
>>>>>    void launchFelix()
>>>>>    {
>>>>>            Log.d("Felix", "About to start Felix...");
>>>>>            // Create a configuration property map
>>>>>            String cacheDir = null;
>>>>>            //String FELIX_CACHE_DIR =
>>>>> "/data/data/net.luminis.android.felix/cache";
>>>>>            try {
>>>>>                    cacheDir = File.createTempFile("skifta", ".tmp").getParent();
>>>>>            } catch (IOException e) {
>>>>>                    Log.d("Felix", "unable to create temp file", e);
>>>>>                    return;
>>>>>            }
>>>>> .
>>>>> .
>>>>> .
>>>>>
>>>>> Because I don't have permissions to write in the /sdcard directory of
>>>>> the
>>>>> emulator. So, the program can't create the temp file.
>>>>>
>>>>> somebody knows how I can add permissions to this directory?
>>>>> Thanks.
>>>>
>>>> Recent Android version have introduced a permission to write on the
>>>> sdcard
>>>> Add this line to your manifest:
>>>> <uses-permission
>>>> android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
>>>>
>>>> Moreover, check that you have created an AVD with an SDCARD.
>>>>
>>>> Regards,
>>>>
>>>> Clement
>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> clement escoffier wrote:
>>>>>>
>>>>>>
>>>>>> On 15.02.2010, at 18:56, pablomj wrote:
>>>>>>
>>>>>>>
>>>>>>> Hi everyone, here are my advances,
>>>>>>>
>>>>>>> I reviewed all steps, I can instanciate a Felix object like in your
>>>>>>> example.
>>>>>>> It was a problem with dependencies.
>>>>>>>
>>>>>>> Proving for install for start and stop a bundle I made in the code:
>>>>>>>
>>>>>>>           BundleContext newBundle = m_felix.getBundleContext();
>>>>>>>           bb.installBundle(pathOfTheBundle);
>>>>>>>
>>>>>>> When...now my problem is this pathOfTheBundle, I tried put in
>>>>>>> pathOfTheBundle "/data/felix/EnglishDictionary.jar" (location where I
>>>>>>> put
>>>>>>> this bundle with adb push ..... in console )and some variants, but
>>>>>>> always
>>>>>>> is
>>>>>>> an wrong path. What I must express my bundle location?
>>>>>>>
>>>>>>> Can anybody help me? Thanks again.
>>>>>>
>>>>>> Try with: file:/data/felix//EnglishDictionary.jar.
>>>>>>
>>>>>> Be also aware that this location is not available on regular devices.
>>>>>> For
>>>>>> such kind of manipulation, you should use the external storage
>>>>>> (generally
>>>>>> /sdcard, but use the Environment class to get the root). (you can also
>>>>>> use
>>>>>> the internal application assets).
>>>>>>
>>>>>> Regards,
>>>>>>
>>>>>> Clement
>>>>>>
>>>>>>>
>>>>>>> Regards, Pablo.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Jackson, Bruce wrote:
>>>>>>>>
>>>>>>>> Yes, you can.
>>>>>>>>
>>>>>>>> In the code I sent you, you'll see that you can get a handle to the
>>>>>>>> BundleContext for the framework itself. From this you can then call:
>>>>>>>>
>>>>>>>> context.installBundle(String location);
>>>>>>>>
>>>>>>>> to install your own bundles.
>>>>>>>>
>>>>>>>>
>>>>>>>> On 12/02/2010 15:07, "pablomj" <pa...@hotmail.es> wrote:
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Oh, thanks Bruce and Karl for your comments.
>>>>>>>>>
>>>>>>>>> I did something wrong, because I can't instanciate an "Felix"
>>>>>>>>> object.
>>>>>>>>> So,
>>>>>>>>> I
>>>>>>>>> am going to review all steps...
>>>>>>>>>
>>>>>>>>> Although I don't see running this yet, I will can start and stop
>>>>>>>>> bundles
>>>>>>>>> from my Android application? I excited to view this!
>>>>>>>>>
>>>>>>>>> Regards,
>>>>>>>>> Pablo.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Karl Pauls wrote:
>>>>>>>>>>
>>>>>>>>>> Why would you need 1.5 to be able to dex the bundle (the framework
>>>>>>>>>> itself is build for 1.3 btw.)?
>>>>>>>>>>
>>>>>>>>>> regards,
>>>>>>>>>>
>>>>>>>>>> Karl
>>>>>>>>>>
>>>>>>>>>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce
>>>>>>>>>> <br...@qualcomm.com>
>>>>>>>>>> wrote:
>>>>>>>>>>> Hi Pablo
>>>>>>>>>>>
>>>>>>>>>>> See the attached code. The biggest problem I've encountered is
>>>>>>>>>>> that
>>>>>>>>>>> the
>>>>>>>>>>> Felix distribution is a huge pain to build under JDK 1.5, and
>>>>>>>>>>> therefore
>>>>>>>>>>> to
>>>>>>>>>>> be able to use some of the bundles (for example the http service)
>>>>>>>>>>> that
>>>>>>>>>>> are
>>>>>>>>>>> part of the distribution. Its not a simple job of just changing a
>>>>>>>>>>> couple
>>>>>>>>>>> of
>>>>>>>>>>> entries in POM files: some components download pre-built JAR
>>>>>>>>>>> files
>>>>>>>>>>> from
>>>>>>>>>>> the
>>>>>>>>>>> web and explode these, thereby having classes built under 1.4
>>>>>>>>>>> which
>>>>>>>>>>> will
>>>>>>>>>>> not
>>>>>>>>>>> work when you dexify the bundles.
>>>>>>>>>>>
>>>>>>>>>>> This is something that would be great to see some work done on by
>>>>>>>>>>> the
>>>>>>>>>>> Felix
>>>>>>>>>>> community, because while its true that the basic Felix core does
>>>>>>>>>>> and
>>>>>>>>>>> will
>>>>>>>>>>> support Android, most of the add-on bundles wont.
>>>>>>>>>>>
>>>>>>>>>>> For my part, the ideal solution would be to see the whole
>>>>>>>>>>> framework
>>>>>>>>>>> be
>>>>>>>>>>> based
>>>>>>>>>>> on JDK 1.5 and not 1.4.
>>>>>>>>>>>
>>>>>>>>>>> Thanks
>>>>>>>>>>>
>>>>>>>>>>> Bruce
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Hi Bruce, I am trying the same, but I don't have the solution
>>>>>>>>>>>> yet.
>>>>>>>>>>>> Do you have some advance?
>>>>>>>>>>>> Salutations, thanks.
>>>>>>>>>>>> Pablo.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Jackson, Bruce wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>> The Felix site has a useful section on getting things going on
>>>>>>>>>>>>> Android
>>>>>>>>>>>>> (
>>>>>>>>>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html)
>>>>>>>>>>>>> but
>>>>>>>>>>>>> isn't
>>>>>>>>>>>>> so clear about embedding the framework into an Android app"
>>>>>>>>>>>>>
>>>>>>>>>>>>> "Apache Felix can also be integrated with an Android
>>>>>>>>>>>>> application.
>>>>>>>>>>>>> To
>>>>>>>>>>>>> achieve
>>>>>>>>>>>>> this, you need to embed Felix into onCreate() method of your
>>>>>>>>>>>>> Activity
>>>>>>>>>>>>> class
>>>>>>>>>>>>> (see Android docs for more details on how to use an Activity)
>>>>>>>>>>>>> and
>>>>>>>>>>>>> process
>>>>>>>>>>>>> your bundles as shown above."
>>>>>>>>>>>>>
>>>>>>>>>>>>> Has anyone got an example of how you do this? I understand how
>>>>>>>>>>>>> to
>>>>>>>>>>>>> write
>>>>>>>>>>>>> the
>>>>>>>>>>>>> Android app, and I get the point being made here. What I need
>>>>>>>>>>>>> to
>>>>>>>>>>>>> understand
>>>>>>>>>>>>> is:
>>>>>>>>>>>>>
>>>>>>>>>>>>> 1. How do you launch the Felix framework. What do I need to
>>>>>>>>>>>>> instantiate?
>>>>>>>>>>>>> 2. Where does the framework get its boot configuration (i.e.
>>>>>>>>>>>>> what
>>>>>>>>>>>>> bundles
>>>>>>>>>>>>> to
>>>>>>>>>>>>> load, run levels, environment variables, etc) from in this
>>>>>>>>>>>>> case?
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Karl Pauls
>>>>>>>>>> karlpauls@gmail.com
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://old.nabble.com/Felix-on-Android-tp27245141p27597525.html
>>>>>>> Sent from the Apache Felix - Dev mailing list archive at Nabble.com.
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://old.nabble.com/Felix-on-Android-tp27245141p27612787.html
>>>>> Sent from the Apache Felix - Dev mailing list archive at Nabble.com.
>>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Felix-on-Android-tp27245141p27714130.html
> Sent from the Apache Felix - Dev mailing list archive at Nabble.com.
>
>



-- 
Karl Pauls
karlpauls@gmail.com

Re: Felix on Android

Posted by Johana <io...@gmail.com>.
I have the exact same problem. I get a NullPointerException when I want to
extract the service with a specific serviceReference:

ref = bc.getServiceReference(sb[j].toString());
Log.d("REF", ref.toString());
        			   
Object service = bc.getService(ref); 

It does not even get to the 3rd line of code... Does anybody have an idea
why? The service appears to be registered.



pablomj wrote:
> 
> Well, I learned that the EnglishDictionary.jar bundle it is installed
> (also Spellchecker and FrenchDictionary) because I obtained all bundles of
> the bundlecontext of felix.
> And I extracted the registered services of this bundles with:
> 
> ServiceReference[] sb=bc.getBundles()[i].getRegisteredServices();
> 
> Printing with:
> 
> Log.d("FELIX","registered services: "+sb[j].toString()); 
> 
> I obtain:
> 02-18 17:40:41.818: DEBUG/FELIX(847): registered services:
> [tutorial.example2.service.DictionaryService]
> 
> It's a good new. Now...I want instanciate this service ...but I can't
> instanciate a "DictionaryService" object :(. Some comment? I continue with
> this, slowly but with energy. 
> 
> 
> Best Regards,
> Pablo.
> 
> 
> 
> 
> 
> pablomj wrote:
>> 
>> Good day, I have good and bad news.
>> 
>> Firts, Clement thanks, exactly it is need to add in the manifest file the
>> line:
>> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
>> />
>> 
>> But, it is not enough if you are proving in a emulator. In this case, you
>> need emulate an sdcard because if you don't make this you will not have
>> permissions in the sdcard. So, if someday you have this problem, you must
>> write in console in sdk path/tools:
>> 
>> mksdcard 64M mySDCard (this creates the sdcard)
>> android create avd -n nombre -t 4 (this creates an emulator)
>> emulator -avd nombre -sdcard mySDCard (this launches the emulator with
>> the sdcard)
>> 
>> At this moment, you can create and push files in sdcard. Now, in my case
>> is important don't forget make the push collectionOfJarsFiles in this new
>> emulator with
>> adb push C:\EclipseDevelopment\ApacheFelix\Apache_felix_demo\bundle
>> /data/felix
>> 
>> 
>> Well, the bad news are that...now I can install a bundle but I think this
>> is wrong.
>> 
>> I put here the modified code provided by Bruce:
>> 
>> void launchFelix() 
>>     {	
>>     	Log.d("Felix", "About to start Felix...");
>>     	// Create a configuration property map	
>>     	String cacheDir = null;
>>     	try 
>>     	{
>>     		cacheDir = File.createTempFile("skifta", ".tmp").getParent();
>> 		} 
>>     	catch (IOException e) 
>>     	{
>> 			Log.d("Felix", "unable to create temp file", e);
>> 			return;
>> 		}
>>        	
>>         Map configMap = new StringMap(false); 
>>         configMap.put("org.osgi.framework.storage", cacheDir);
>>         configMap.put("felix.embedded.execution", "true");
>>         configMap.put("org.osgi.service.http.port", "9990");
>>         configMap.put("org.osgi.framework.startlevel.beginning", "5");
>> 
>>         try
>>         {
>>             // Now create an instance of the framework with
>>             // our configuration properties.
>>             m_felix = new Felix(configMap);
>>             // Now start Felix instance.
>>             m_felix.start();
>>             Log.d("Felix", "Felix is started");
>>             
>>             BundleContext bc=m_felix.getBundleContext();
>>             bc.installBundle("file:/data/felix/EnglishDictionary.jar");          
>>             
>>             for(org.osgi.framework.Bundle b :
>> m_felix.getBundleContext().getBundles()) 
>>             {
>>             	b.start();
>>             	Log.d("Felix", "Bundle: " + b.getSymbolicName());	
>>             }
>>         } 
>>         catch (Throwable ex) 
>>         {
>>             Log.d("Felix","Could not create framework: " +
>> ex.getMessage(), ex);
>>         }
>>     }    
>> 
>> 
>> Well, the install is it made without problems, program don't jumps to the
>> catch. So, I make install of the EnglishDictionary.jar. But, then, when I
>> iterate in the for, the b.start() is also made, but I think that I am
>> doing something wrong because b.getSymbolicName() "null". 
>> 
>> So, what do you think?The bundle is installed?I installed a void bundle?I
>> made something wrong?
>> 
>> Salutations and thanks for everyone.
>> Pablo Muñoz.
>> 
>> 
>> 
>> clement escoffier wrote:
>>> 
>>> Hi,
>>> 
>>> 
>>> 
>>> On 16.02.2010, at 19:20, pablomj wrote:
>>> 
>>>> 
>>>> Hi everyone, I know what is my current problem.
>>>> 
>>>> the problem is in this try
>>>> 
>>>>    void launchFelix() 
>>>>    {
>>>>    	Log.d("Felix", "About to start Felix...");
>>>>    	// Create a configuration property map
>>>>    	String cacheDir = null;
>>>>    	//String FELIX_CACHE_DIR =
>>>> "/data/data/net.luminis.android.felix/cache";
>>>>    	try {
>>>> 			cacheDir = File.createTempFile("skifta", ".tmp").getParent();
>>>> 		} catch (IOException e) {
>>>> 			Log.d("Felix", "unable to create temp file", e);
>>>> 			return;
>>>> 		}
>>>> .
>>>> .
>>>> .
>>>> 
>>>> Because I don't have permissions to write in the /sdcard directory of
>>>> the
>>>> emulator. So, the program can't create the temp file.
>>>> 
>>>> somebody knows how I can add permissions to this directory?
>>>> Thanks.
>>> 
>>> Recent Android version have introduced a permission to write on the
>>> sdcard
>>> Add this line to your manifest:
>>> <uses-permission
>>> android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
>>> 
>>> Moreover, check that you have created an AVD with an SDCARD. 
>>> 
>>> Regards,
>>> 
>>> Clement
>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> clement escoffier wrote:
>>>>> 
>>>>> 
>>>>> On 15.02.2010, at 18:56, pablomj wrote:
>>>>> 
>>>>>> 
>>>>>> Hi everyone, here are my advances,
>>>>>> 
>>>>>> I reviewed all steps, I can instanciate a Felix object like in your
>>>>>> example.
>>>>>> It was a problem with dependencies. 
>>>>>> 
>>>>>> Proving for install for start and stop a bundle I made in the code:
>>>>>> 
>>>>>>           BundleContext newBundle = m_felix.getBundleContext();
>>>>>>           bb.installBundle(pathOfTheBundle);
>>>>>> 
>>>>>> When...now my problem is this pathOfTheBundle, I tried put in
>>>>>> pathOfTheBundle "/data/felix/EnglishDictionary.jar" (location where I
>>>>>> put
>>>>>> this bundle with adb push ..... in console )and some variants, but
>>>>>> always
>>>>>> is
>>>>>> an wrong path. What I must express my bundle location?
>>>>>> 
>>>>>> Can anybody help me? Thanks again. 
>>>>> 
>>>>> Try with: file:/data/felix//EnglishDictionary.jar. 
>>>>> 
>>>>> Be also aware that this location is not available on regular devices.
>>>>> For
>>>>> such kind of manipulation, you should use the external storage
>>>>> (generally
>>>>> /sdcard, but use the Environment class to get the root). (you can also
>>>>> use
>>>>> the internal application assets).
>>>>> 
>>>>> Regards,
>>>>> 
>>>>> Clement
>>>>> 
>>>>>> 
>>>>>> Regards, Pablo.
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> Jackson, Bruce wrote:
>>>>>>> 
>>>>>>> Yes, you can.
>>>>>>> 
>>>>>>> In the code I sent you, you'll see that you can get a handle to the
>>>>>>> BundleContext for the framework itself. From this you can then call:
>>>>>>> 
>>>>>>> context.installBundle(String location);
>>>>>>> 
>>>>>>> to install your own bundles.
>>>>>>> 
>>>>>>> 
>>>>>>> On 12/02/2010 15:07, "pablomj" <pa...@hotmail.es> wrote:
>>>>>>> 
>>>>>>>> 
>>>>>>>> Oh, thanks Bruce and Karl for your comments.
>>>>>>>> 
>>>>>>>> I did something wrong, because I can't instanciate an "Felix"
>>>>>>>> object.
>>>>>>>> So,
>>>>>>>> I
>>>>>>>> am going to review all steps...
>>>>>>>> 
>>>>>>>> Although I don't see running this yet, I will can start and stop
>>>>>>>> bundles
>>>>>>>> from my Android application? I excited to view this!
>>>>>>>> 
>>>>>>>> Regards,
>>>>>>>> Pablo.
>>>>>>>> 
>>>>>>>> 
>>>>>>>> Karl Pauls wrote:
>>>>>>>>> 
>>>>>>>>> Why would you need 1.5 to be able to dex the bundle (the framework
>>>>>>>>> itself is build for 1.3 btw.)?
>>>>>>>>> 
>>>>>>>>> regards,
>>>>>>>>> 
>>>>>>>>> Karl
>>>>>>>>> 
>>>>>>>>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce
>>>>>>>>> <br...@qualcomm.com>
>>>>>>>>> wrote:
>>>>>>>>>> Hi Pablo
>>>>>>>>>> 
>>>>>>>>>> See the attached code. The biggest problem I've encountered is
>>>>>>>>>> that
>>>>>>>>>> the
>>>>>>>>>> Felix distribution is a huge pain to build under JDK 1.5, and
>>>>>>>>>> therefore
>>>>>>>>>> to
>>>>>>>>>> be able to use some of the bundles (for example the http service)
>>>>>>>>>> that
>>>>>>>>>> are
>>>>>>>>>> part of the distribution. Its not a simple job of just changing a
>>>>>>>>>> couple
>>>>>>>>>> of
>>>>>>>>>> entries in POM files: some components download pre-built JAR
>>>>>>>>>> files
>>>>>>>>>> from
>>>>>>>>>> the
>>>>>>>>>> web and explode these, thereby having classes built under 1.4
>>>>>>>>>> which
>>>>>>>>>> will
>>>>>>>>>> not
>>>>>>>>>> work when you dexify the bundles.
>>>>>>>>>> 
>>>>>>>>>> This is something that would be great to see some work done on by
>>>>>>>>>> the
>>>>>>>>>> Felix
>>>>>>>>>> community, because while its true that the basic Felix core does
>>>>>>>>>> and
>>>>>>>>>> will
>>>>>>>>>> support Android, most of the add-on bundles wont.
>>>>>>>>>> 
>>>>>>>>>> For my part, the ideal solution would be to see the whole
>>>>>>>>>> framework
>>>>>>>>>> be
>>>>>>>>>> based
>>>>>>>>>> on JDK 1.5 and not 1.4.
>>>>>>>>>> 
>>>>>>>>>> Thanks
>>>>>>>>>> 
>>>>>>>>>> Bruce
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> Hi Bruce, I am trying the same, but I don't have the solution
>>>>>>>>>>> yet.
>>>>>>>>>>> Do you have some advance?
>>>>>>>>>>> Salutations, thanks.
>>>>>>>>>>> Pablo.
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> Jackson, Bruce wrote:
>>>>>>>>>>>> 
>>>>>>>>>>>> The Felix site has a useful section on getting things going on
>>>>>>>>>>>> Android
>>>>>>>>>>>> (
>>>>>>>>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html)
>>>>>>>>>>>> but
>>>>>>>>>>>> isn't
>>>>>>>>>>>> so clear about embedding the framework into an Android app"
>>>>>>>>>>>> 
>>>>>>>>>>>> "Apache Felix can also be integrated with an Android
>>>>>>>>>>>> application.
>>>>>>>>>>>> To
>>>>>>>>>>>> achieve
>>>>>>>>>>>> this, you need to embed Felix into onCreate() method of your
>>>>>>>>>>>> Activity
>>>>>>>>>>>> class
>>>>>>>>>>>> (see Android docs for more details on how to use an Activity)
>>>>>>>>>>>> and
>>>>>>>>>>>> process
>>>>>>>>>>>> your bundles as shown above."
>>>>>>>>>>>> 
>>>>>>>>>>>> Has anyone got an example of how you do this? I understand how
>>>>>>>>>>>> to
>>>>>>>>>>>> write
>>>>>>>>>>>> the
>>>>>>>>>>>> Android app, and I get the point being made here. What I need
>>>>>>>>>>>> to
>>>>>>>>>>>> understand
>>>>>>>>>>>> is:
>>>>>>>>>>>> 
>>>>>>>>>>>> 1. How do you launch the Felix framework. What do I need to
>>>>>>>>>>>> instantiate?
>>>>>>>>>>>> 2. Where does the framework get its boot configuration (i.e.
>>>>>>>>>>>> what
>>>>>>>>>>>> bundles
>>>>>>>>>>>> to
>>>>>>>>>>>> load, run levels, environment variables, etc) from in this
>>>>>>>>>>>> case?
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> -- 
>>>>>>>>> Karl Pauls
>>>>>>>>> karlpauls@gmail.com
>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> -- 
>>>>>> View this message in context:
>>>>>> http://old.nabble.com/Felix-on-Android-tp27245141p27597525.html
>>>>>> Sent from the Apache Felix - Dev mailing list archive at Nabble.com.
>>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> -- 
>>>> View this message in context:
>>>> http://old.nabble.com/Felix-on-Android-tp27245141p27612787.html
>>>> Sent from the Apache Felix - Dev mailing list archive at Nabble.com.
>>>> 
>>> 
>>> 
>>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Felix-on-Android-tp27245141p27714130.html
Sent from the Apache Felix - Dev mailing list archive at Nabble.com.


Re: Felix on Android

Posted by pablomj <pa...@hotmail.es>.
Well, I learned that the EnglishDictionary.jar bundle it is installed (also
Spellchecker and FrenchDictionary) because I obtained all bundles of the
bundlecontext of felix.
And I extracted the registered services of this bundles with:

ServiceReference[] sb=bc.getBundles()[i].getRegisteredServices();

Printing with:

Log.d("FELIX","registered services: "+sb[j].toString()); 

I obtain:
02-18 17:40:41.818: DEBUG/FELIX(847): registered services:
[tutorial.example2.service.DictionaryService]

It's a good new. Now...I want instanciate this service ...but I can't
instanciate a "DictionaryService" object :(. Some comment? I continue with
this, slowly but with energy. 


Best Regards,
Pablo.





pablomj wrote:
> 
> Good day, I have good and bad news.
> 
> Firts, Clement thanks, exactly it is need to add in the manifest file the
> line:
> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
> />
> 
> But, it is not enough if you are proving in a emulator. In this case, you
> need emulate an sdcard because if you don't make this you will not have
> permissions in the sdcard. So, if someday you have this problem, you must
> write in console in sdk path/tools:
> 
> mksdcard 64M mySDCard (this creates the sdcard)
> android create avd -n nombre -t 4 (this creates an emulator)
> emulator -avd nombre -sdcard mySDCard (this launches the emulator with the
> sdcard)
> 
> At this moment, you can create and push files in sdcard. Now, in my case
> is important don't forget make the push collectionOfJarsFiles in this new
> emulator with
> adb push C:\EclipseDevelopment\ApacheFelix\Apache_felix_demo\bundle
> /data/felix
> 
> 
> Well, the bad news are that...now I can install a bundle but I think this
> is wrong.
> 
> I put here the modified code provided by Bruce:
> 
> void launchFelix() 
>     {	
>     	Log.d("Felix", "About to start Felix...");
>     	// Create a configuration property map	
>     	String cacheDir = null;
>     	try 
>     	{
>     		cacheDir = File.createTempFile("skifta", ".tmp").getParent();
> 		} 
>     	catch (IOException e) 
>     	{
> 			Log.d("Felix", "unable to create temp file", e);
> 			return;
> 		}
>        	
>         Map configMap = new StringMap(false); 
>         configMap.put("org.osgi.framework.storage", cacheDir);
>         configMap.put("felix.embedded.execution", "true");
>         configMap.put("org.osgi.service.http.port", "9990");
>         configMap.put("org.osgi.framework.startlevel.beginning", "5");
> 
>         try
>         {
>             // Now create an instance of the framework with
>             // our configuration properties.
>             m_felix = new Felix(configMap);
>             // Now start Felix instance.
>             m_felix.start();
>             Log.d("Felix", "Felix is started");
>             
>             BundleContext bc=m_felix.getBundleContext();
>             bc.installBundle("file:/data/felix/EnglishDictionary.jar");          
>             
>             for(org.osgi.framework.Bundle b :
> m_felix.getBundleContext().getBundles()) 
>             {
>             	b.start();
>             	Log.d("Felix", "Bundle: " + b.getSymbolicName());	
>             }
>         } 
>         catch (Throwable ex) 
>         {
>             Log.d("Felix","Could not create framework: " +
> ex.getMessage(), ex);
>         }
>     }    
> 
> 
> Well, the install is it made without problems, program don't jumps to the
> catch. So, I make install of the EnglishDictionary.jar. But, then, when I
> iterate in the for, the b.start() is also made, but I think that I am
> doing something wrong because b.getSymbolicName() "null". 
> 
> So, what do you think?The bundle is installed?I installed a void bundle?I
> made something wrong?
> 
> Salutations and thanks for everyone.
> Pablo Muñoz.
> 
> 
> 
> clement escoffier wrote:
>> 
>> Hi,
>> 
>> 
>> 
>> On 16.02.2010, at 19:20, pablomj wrote:
>> 
>>> 
>>> Hi everyone, I know what is my current problem.
>>> 
>>> the problem is in this try
>>> 
>>>    void launchFelix() 
>>>    {
>>>    	Log.d("Felix", "About to start Felix...");
>>>    	// Create a configuration property map
>>>    	String cacheDir = null;
>>>    	//String FELIX_CACHE_DIR =
>>> "/data/data/net.luminis.android.felix/cache";
>>>    	try {
>>> 			cacheDir = File.createTempFile("skifta", ".tmp").getParent();
>>> 		} catch (IOException e) {
>>> 			Log.d("Felix", "unable to create temp file", e);
>>> 			return;
>>> 		}
>>> .
>>> .
>>> .
>>> 
>>> Because I don't have permissions to write in the /sdcard directory of
>>> the
>>> emulator. So, the program can't create the temp file.
>>> 
>>> somebody knows how I can add permissions to this directory?
>>> Thanks.
>> 
>> Recent Android version have introduced a permission to write on the
>> sdcard
>> Add this line to your manifest:
>> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
>> />
>> 
>> Moreover, check that you have created an AVD with an SDCARD. 
>> 
>> Regards,
>> 
>> Clement
>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> clement escoffier wrote:
>>>> 
>>>> 
>>>> On 15.02.2010, at 18:56, pablomj wrote:
>>>> 
>>>>> 
>>>>> Hi everyone, here are my advances,
>>>>> 
>>>>> I reviewed all steps, I can instanciate a Felix object like in your
>>>>> example.
>>>>> It was a problem with dependencies. 
>>>>> 
>>>>> Proving for install for start and stop a bundle I made in the code:
>>>>> 
>>>>>           BundleContext newBundle = m_felix.getBundleContext();
>>>>>           bb.installBundle(pathOfTheBundle);
>>>>> 
>>>>> When...now my problem is this pathOfTheBundle, I tried put in
>>>>> pathOfTheBundle "/data/felix/EnglishDictionary.jar" (location where I
>>>>> put
>>>>> this bundle with adb push ..... in console )and some variants, but
>>>>> always
>>>>> is
>>>>> an wrong path. What I must express my bundle location?
>>>>> 
>>>>> Can anybody help me? Thanks again. 
>>>> 
>>>> Try with: file:/data/felix//EnglishDictionary.jar. 
>>>> 
>>>> Be also aware that this location is not available on regular devices.
>>>> For
>>>> such kind of manipulation, you should use the external storage
>>>> (generally
>>>> /sdcard, but use the Environment class to get the root). (you can also
>>>> use
>>>> the internal application assets).
>>>> 
>>>> Regards,
>>>> 
>>>> Clement
>>>> 
>>>>> 
>>>>> Regards, Pablo.
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> Jackson, Bruce wrote:
>>>>>> 
>>>>>> Yes, you can.
>>>>>> 
>>>>>> In the code I sent you, you'll see that you can get a handle to the
>>>>>> BundleContext for the framework itself. From this you can then call:
>>>>>> 
>>>>>> context.installBundle(String location);
>>>>>> 
>>>>>> to install your own bundles.
>>>>>> 
>>>>>> 
>>>>>> On 12/02/2010 15:07, "pablomj" <pa...@hotmail.es> wrote:
>>>>>> 
>>>>>>> 
>>>>>>> Oh, thanks Bruce and Karl for your comments.
>>>>>>> 
>>>>>>> I did something wrong, because I can't instanciate an "Felix"
>>>>>>> object.
>>>>>>> So,
>>>>>>> I
>>>>>>> am going to review all steps...
>>>>>>> 
>>>>>>> Although I don't see running this yet, I will can start and stop
>>>>>>> bundles
>>>>>>> from my Android application? I excited to view this!
>>>>>>> 
>>>>>>> Regards,
>>>>>>> Pablo.
>>>>>>> 
>>>>>>> 
>>>>>>> Karl Pauls wrote:
>>>>>>>> 
>>>>>>>> Why would you need 1.5 to be able to dex the bundle (the framework
>>>>>>>> itself is build for 1.3 btw.)?
>>>>>>>> 
>>>>>>>> regards,
>>>>>>>> 
>>>>>>>> Karl
>>>>>>>> 
>>>>>>>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce
>>>>>>>> <br...@qualcomm.com>
>>>>>>>> wrote:
>>>>>>>>> Hi Pablo
>>>>>>>>> 
>>>>>>>>> See the attached code. The biggest problem I've encountered is
>>>>>>>>> that
>>>>>>>>> the
>>>>>>>>> Felix distribution is a huge pain to build under JDK 1.5, and
>>>>>>>>> therefore
>>>>>>>>> to
>>>>>>>>> be able to use some of the bundles (for example the http service)
>>>>>>>>> that
>>>>>>>>> are
>>>>>>>>> part of the distribution. Its not a simple job of just changing a
>>>>>>>>> couple
>>>>>>>>> of
>>>>>>>>> entries in POM files: some components download pre-built JAR files
>>>>>>>>> from
>>>>>>>>> the
>>>>>>>>> web and explode these, thereby having classes built under 1.4
>>>>>>>>> which
>>>>>>>>> will
>>>>>>>>> not
>>>>>>>>> work when you dexify the bundles.
>>>>>>>>> 
>>>>>>>>> This is something that would be great to see some work done on by
>>>>>>>>> the
>>>>>>>>> Felix
>>>>>>>>> community, because while its true that the basic Felix core does
>>>>>>>>> and
>>>>>>>>> will
>>>>>>>>> support Android, most of the add-on bundles wont.
>>>>>>>>> 
>>>>>>>>> For my part, the ideal solution would be to see the whole
>>>>>>>>> framework
>>>>>>>>> be
>>>>>>>>> based
>>>>>>>>> on JDK 1.5 and not 1.4.
>>>>>>>>> 
>>>>>>>>> Thanks
>>>>>>>>> 
>>>>>>>>> Bruce
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> Hi Bruce, I am trying the same, but I don't have the solution
>>>>>>>>>> yet.
>>>>>>>>>> Do you have some advance?
>>>>>>>>>> Salutations, thanks.
>>>>>>>>>> Pablo.
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> Jackson, Bruce wrote:
>>>>>>>>>>> 
>>>>>>>>>>> The Felix site has a useful section on getting things going on
>>>>>>>>>>> Android
>>>>>>>>>>> (
>>>>>>>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html)
>>>>>>>>>>> but
>>>>>>>>>>> isn't
>>>>>>>>>>> so clear about embedding the framework into an Android app"
>>>>>>>>>>> 
>>>>>>>>>>> "Apache Felix can also be integrated with an Android
>>>>>>>>>>> application.
>>>>>>>>>>> To
>>>>>>>>>>> achieve
>>>>>>>>>>> this, you need to embed Felix into onCreate() method of your
>>>>>>>>>>> Activity
>>>>>>>>>>> class
>>>>>>>>>>> (see Android docs for more details on how to use an Activity)
>>>>>>>>>>> and
>>>>>>>>>>> process
>>>>>>>>>>> your bundles as shown above."
>>>>>>>>>>> 
>>>>>>>>>>> Has anyone got an example of how you do this? I understand how
>>>>>>>>>>> to
>>>>>>>>>>> write
>>>>>>>>>>> the
>>>>>>>>>>> Android app, and I get the point being made here. What I need to
>>>>>>>>>>> understand
>>>>>>>>>>> is:
>>>>>>>>>>> 
>>>>>>>>>>> 1. How do you launch the Felix framework. What do I need to
>>>>>>>>>>> instantiate?
>>>>>>>>>>> 2. Where does the framework get its boot configuration (i.e.
>>>>>>>>>>> what
>>>>>>>>>>> bundles
>>>>>>>>>>> to
>>>>>>>>>>> load, run levels, environment variables, etc) from in this case?
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> -- 
>>>>>>>> Karl Pauls
>>>>>>>> karlpauls@gmail.com
>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> -- 
>>>>> View this message in context:
>>>>> http://old.nabble.com/Felix-on-Android-tp27245141p27597525.html
>>>>> Sent from the Apache Felix - Dev mailing list archive at Nabble.com.
>>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> -- 
>>> View this message in context:
>>> http://old.nabble.com/Felix-on-Android-tp27245141p27612787.html
>>> Sent from the Apache Felix - Dev mailing list archive at Nabble.com.
>>> 
>> 
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Felix-on-Android-tp27245141p27642947.html
Sent from the Apache Felix - Dev mailing list archive at Nabble.com.


Re: Felix on Android

Posted by pablomj <pa...@hotmail.es>.
Good day, I have good and bad news.

Firts, Clement thanks, exactly it is need to add in the manifest file the
line:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

But, it is not enough if you are proving in a emulator. In this case, you
need emulate an sdcard because if you don't make this you will not have
permissions in the sdcard. So, if someday you have this problem, you must
write in console in sdk path/tools:

mksdcard 64M mySDCard (this creates the sdcard)
android create avd -n nombre -t 4 (this creates an emulator)
emulator -avd nombre -sdcard mySDCard (this launches the emulator with the
sdcard)

At this moment, you can create and push files in sdcard. Now, in my case is
important don't forget make the push collectionOfJarsFiles in this new
emulator with
adb push C:\EclipseDevelopment\ApacheFelix\Apache_felix_demo\bundle
/data/felix


Well, the bad news are that...now I can install a bundle but I think this is
wrong.

I put here the modified code provided by Bruce:

void launchFelix() 
    {	
    	Log.d("Felix", "About to start Felix...");
    	// Create a configuration property map	
    	String cacheDir = null;
    	try 
    	{
    		cacheDir = File.createTempFile("skifta", ".tmp").getParent();
		} 
    	catch (IOException e) 
    	{
			Log.d("Felix", "unable to create temp file", e);
			return;
		}
       	
        Map configMap = new StringMap(false); 
        configMap.put("org.osgi.framework.storage", cacheDir);
        configMap.put("felix.embedded.execution", "true");
        configMap.put("org.osgi.service.http.port", "9990");
        configMap.put("org.osgi.framework.startlevel.beginning", "5");

        try
        {
            // Now create an instance of the framework with
            // our configuration properties.
            m_felix = new Felix(configMap);
            // Now start Felix instance.
            m_felix.start();
            Log.d("Felix", "Felix is started");
            
            BundleContext bc=m_felix.getBundleContext();
            bc.installBundle("file:/data/felix/EnglishDictionary.jar");          
            
            for(org.osgi.framework.Bundle b :
m_felix.getBundleContext().getBundles()) 
            {
            	b.start();
            	Log.d("Felix", "Bundle: " + b.getSymbolicName());	
            }
        } 
        catch (Throwable ex) 
        {
            Log.d("Felix","Could not create framework: " + ex.getMessage(),
ex);
        }
    }    


Well, the install is it made without problems, program don't jumps to the
catch. So, I make install of the EnglishDictionary.jar. But, then, when I
iterate in the for, the b.start() is also made, but I think that I am doing
something wrong because b.getSymbolicName() "null". 

So, what do you think?The bundle is installed?I installed a void bundle?I
made something wrong?

Salutations and thanks for everyone.
Pablo Muñoz.



clement escoffier wrote:
> 
> Hi,
> 
> 
> 
> On 16.02.2010, at 19:20, pablomj wrote:
> 
>> 
>> Hi everyone, I know what is my current problem.
>> 
>> the problem is in this try
>> 
>>    void launchFelix() 
>>    {
>>    	Log.d("Felix", "About to start Felix...");
>>    	// Create a configuration property map
>>    	String cacheDir = null;
>>    	//String FELIX_CACHE_DIR =
>> "/data/data/net.luminis.android.felix/cache";
>>    	try {
>> 			cacheDir = File.createTempFile("skifta", ".tmp").getParent();
>> 		} catch (IOException e) {
>> 			Log.d("Felix", "unable to create temp file", e);
>> 			return;
>> 		}
>> .
>> .
>> .
>> 
>> Because I don't have permissions to write in the /sdcard directory of the
>> emulator. So, the program can't create the temp file.
>> 
>> somebody knows how I can add permissions to this directory?
>> Thanks.
> 
> Recent Android version have introduced a permission to write on the sdcard
> Add this line to your manifest:
> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
> />
> 
> Moreover, check that you have created an AVD with an SDCARD. 
> 
> Regards,
> 
> Clement
> 
>> 
>> 
>> 
>> 
>> 
>> clement escoffier wrote:
>>> 
>>> 
>>> On 15.02.2010, at 18:56, pablomj wrote:
>>> 
>>>> 
>>>> Hi everyone, here are my advances,
>>>> 
>>>> I reviewed all steps, I can instanciate a Felix object like in your
>>>> example.
>>>> It was a problem with dependencies. 
>>>> 
>>>> Proving for install for start and stop a bundle I made in the code:
>>>> 
>>>>           BundleContext newBundle = m_felix.getBundleContext();
>>>>           bb.installBundle(pathOfTheBundle);
>>>> 
>>>> When...now my problem is this pathOfTheBundle, I tried put in
>>>> pathOfTheBundle "/data/felix/EnglishDictionary.jar" (location where I
>>>> put
>>>> this bundle with adb push ..... in console )and some variants, but
>>>> always
>>>> is
>>>> an wrong path. What I must express my bundle location?
>>>> 
>>>> Can anybody help me? Thanks again. 
>>> 
>>> Try with: file:/data/felix//EnglishDictionary.jar. 
>>> 
>>> Be also aware that this location is not available on regular devices.
>>> For
>>> such kind of manipulation, you should use the external storage
>>> (generally
>>> /sdcard, but use the Environment class to get the root). (you can also
>>> use
>>> the internal application assets).
>>> 
>>> Regards,
>>> 
>>> Clement
>>> 
>>>> 
>>>> Regards, Pablo.
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Jackson, Bruce wrote:
>>>>> 
>>>>> Yes, you can.
>>>>> 
>>>>> In the code I sent you, you'll see that you can get a handle to the
>>>>> BundleContext for the framework itself. From this you can then call:
>>>>> 
>>>>> context.installBundle(String location);
>>>>> 
>>>>> to install your own bundles.
>>>>> 
>>>>> 
>>>>> On 12/02/2010 15:07, "pablomj" <pa...@hotmail.es> wrote:
>>>>> 
>>>>>> 
>>>>>> Oh, thanks Bruce and Karl for your comments.
>>>>>> 
>>>>>> I did something wrong, because I can't instanciate an "Felix" object.
>>>>>> So,
>>>>>> I
>>>>>> am going to review all steps...
>>>>>> 
>>>>>> Although I don't see running this yet, I will can start and stop
>>>>>> bundles
>>>>>> from my Android application? I excited to view this!
>>>>>> 
>>>>>> Regards,
>>>>>> Pablo.
>>>>>> 
>>>>>> 
>>>>>> Karl Pauls wrote:
>>>>>>> 
>>>>>>> Why would you need 1.5 to be able to dex the bundle (the framework
>>>>>>> itself is build for 1.3 btw.)?
>>>>>>> 
>>>>>>> regards,
>>>>>>> 
>>>>>>> Karl
>>>>>>> 
>>>>>>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce
>>>>>>> <br...@qualcomm.com>
>>>>>>> wrote:
>>>>>>>> Hi Pablo
>>>>>>>> 
>>>>>>>> See the attached code. The biggest problem I've encountered is that
>>>>>>>> the
>>>>>>>> Felix distribution is a huge pain to build under JDK 1.5, and
>>>>>>>> therefore
>>>>>>>> to
>>>>>>>> be able to use some of the bundles (for example the http service)
>>>>>>>> that
>>>>>>>> are
>>>>>>>> part of the distribution. Its not a simple job of just changing a
>>>>>>>> couple
>>>>>>>> of
>>>>>>>> entries in POM files: some components download pre-built JAR files
>>>>>>>> from
>>>>>>>> the
>>>>>>>> web and explode these, thereby having classes built under 1.4 which
>>>>>>>> will
>>>>>>>> not
>>>>>>>> work when you dexify the bundles.
>>>>>>>> 
>>>>>>>> This is something that would be great to see some work done on by
>>>>>>>> the
>>>>>>>> Felix
>>>>>>>> community, because while its true that the basic Felix core does
>>>>>>>> and
>>>>>>>> will
>>>>>>>> support Android, most of the add-on bundles wont.
>>>>>>>> 
>>>>>>>> For my part, the ideal solution would be to see the whole framework
>>>>>>>> be
>>>>>>>> based
>>>>>>>> on JDK 1.5 and not 1.4.
>>>>>>>> 
>>>>>>>> Thanks
>>>>>>>> 
>>>>>>>> Bruce
>>>>>>>> 
>>>>>>>> 
>>>>>>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>>>>>>>> Do you have some advance?
>>>>>>>>> Salutations, thanks.
>>>>>>>>> Pablo.
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> Jackson, Bruce wrote:
>>>>>>>>>> 
>>>>>>>>>> The Felix site has a useful section on getting things going on
>>>>>>>>>> Android
>>>>>>>>>> (
>>>>>>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html)
>>>>>>>>>> but
>>>>>>>>>> isn't
>>>>>>>>>> so clear about embedding the framework into an Android app"
>>>>>>>>>> 
>>>>>>>>>> "Apache Felix can also be integrated with an Android application.
>>>>>>>>>> To
>>>>>>>>>> achieve
>>>>>>>>>> this, you need to embed Felix into onCreate() method of your
>>>>>>>>>> Activity
>>>>>>>>>> class
>>>>>>>>>> (see Android docs for more details on how to use an Activity) and
>>>>>>>>>> process
>>>>>>>>>> your bundles as shown above."
>>>>>>>>>> 
>>>>>>>>>> Has anyone got an example of how you do this? I understand how to
>>>>>>>>>> write
>>>>>>>>>> the
>>>>>>>>>> Android app, and I get the point being made here. What I need to
>>>>>>>>>> understand
>>>>>>>>>> is:
>>>>>>>>>> 
>>>>>>>>>> 1. How do you launch the Felix framework. What do I need to
>>>>>>>>>> instantiate?
>>>>>>>>>> 2. Where does the framework get its boot configuration (i.e. what
>>>>>>>>>> bundles
>>>>>>>>>> to
>>>>>>>>>> load, run levels, environment variables, etc) from in this case?
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> -- 
>>>>>>> Karl Pauls
>>>>>>> karlpauls@gmail.com
>>>>>>> 
>>>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> -- 
>>>> View this message in context:
>>>> http://old.nabble.com/Felix-on-Android-tp27245141p27597525.html
>>>> Sent from the Apache Felix - Dev mailing list archive at Nabble.com.
>>>> 
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://old.nabble.com/Felix-on-Android-tp27245141p27612787.html
>> Sent from the Apache Felix - Dev mailing list archive at Nabble.com.
>> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Felix-on-Android-tp27245141p27625688.html
Sent from the Apache Felix - Dev mailing list archive at Nabble.com.


Re: Felix on Android

Posted by Clement Escoffier <cl...@gmail.com>.
Hi,



On 16.02.2010, at 19:20, pablomj wrote:

> 
> Hi everyone, I know what is my current problem.
> 
> the problem is in this try
> 
>    void launchFelix() 
>    {
>    	Log.d("Felix", "About to start Felix...");
>    	// Create a configuration property map
>    	String cacheDir = null;
>    	//String FELIX_CACHE_DIR =
> "/data/data/net.luminis.android.felix/cache";
>    	try {
> 			cacheDir = File.createTempFile("skifta", ".tmp").getParent();
> 		} catch (IOException e) {
> 			Log.d("Felix", "unable to create temp file", e);
> 			return;
> 		}
> .
> .
> .
> 
> Because I don't have permissions to write in the /sdcard directory of the
> emulator. So, the program can't create the temp file.
> 
> somebody knows how I can add permissions to this directory?
> Thanks.

Recent Android version have introduced a permission to write on the sdcard
Add this line to your manifest:
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Moreover, check that you have created an AVD with an SDCARD. 

Regards,

Clement

> 
> 
> 
> 
> 
> clement escoffier wrote:
>> 
>> 
>> On 15.02.2010, at 18:56, pablomj wrote:
>> 
>>> 
>>> Hi everyone, here are my advances,
>>> 
>>> I reviewed all steps, I can instanciate a Felix object like in your
>>> example.
>>> It was a problem with dependencies. 
>>> 
>>> Proving for install for start and stop a bundle I made in the code:
>>> 
>>>           BundleContext newBundle = m_felix.getBundleContext();
>>>           bb.installBundle(pathOfTheBundle);
>>> 
>>> When...now my problem is this pathOfTheBundle, I tried put in
>>> pathOfTheBundle "/data/felix/EnglishDictionary.jar" (location where I put
>>> this bundle with adb push ..... in console )and some variants, but always
>>> is
>>> an wrong path. What I must express my bundle location?
>>> 
>>> Can anybody help me? Thanks again. 
>> 
>> Try with: file:/data/felix//EnglishDictionary.jar. 
>> 
>> Be also aware that this location is not available on regular devices. For
>> such kind of manipulation, you should use the external storage (generally
>> /sdcard, but use the Environment class to get the root). (you can also use
>> the internal application assets).
>> 
>> Regards,
>> 
>> Clement
>> 
>>> 
>>> Regards, Pablo.
>>> 
>>> 
>>> 
>>> 
>>> Jackson, Bruce wrote:
>>>> 
>>>> Yes, you can.
>>>> 
>>>> In the code I sent you, you'll see that you can get a handle to the
>>>> BundleContext for the framework itself. From this you can then call:
>>>> 
>>>> context.installBundle(String location);
>>>> 
>>>> to install your own bundles.
>>>> 
>>>> 
>>>> On 12/02/2010 15:07, "pablomj" <pa...@hotmail.es> wrote:
>>>> 
>>>>> 
>>>>> Oh, thanks Bruce and Karl for your comments.
>>>>> 
>>>>> I did something wrong, because I can't instanciate an "Felix" object.
>>>>> So,
>>>>> I
>>>>> am going to review all steps...
>>>>> 
>>>>> Although I don't see running this yet, I will can start and stop
>>>>> bundles
>>>>> from my Android application? I excited to view this!
>>>>> 
>>>>> Regards,
>>>>> Pablo.
>>>>> 
>>>>> 
>>>>> Karl Pauls wrote:
>>>>>> 
>>>>>> Why would you need 1.5 to be able to dex the bundle (the framework
>>>>>> itself is build for 1.3 btw.)?
>>>>>> 
>>>>>> regards,
>>>>>> 
>>>>>> Karl
>>>>>> 
>>>>>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>>> wrote:
>>>>>>> Hi Pablo
>>>>>>> 
>>>>>>> See the attached code. The biggest problem I've encountered is that
>>>>>>> the
>>>>>>> Felix distribution is a huge pain to build under JDK 1.5, and
>>>>>>> therefore
>>>>>>> to
>>>>>>> be able to use some of the bundles (for example the http service)
>>>>>>> that
>>>>>>> are
>>>>>>> part of the distribution. Its not a simple job of just changing a
>>>>>>> couple
>>>>>>> of
>>>>>>> entries in POM files: some components download pre-built JAR files
>>>>>>> from
>>>>>>> the
>>>>>>> web and explode these, thereby having classes built under 1.4 which
>>>>>>> will
>>>>>>> not
>>>>>>> work when you dexify the bundles.
>>>>>>> 
>>>>>>> This is something that would be great to see some work done on by the
>>>>>>> Felix
>>>>>>> community, because while its true that the basic Felix core does and
>>>>>>> will
>>>>>>> support Android, most of the add-on bundles wont.
>>>>>>> 
>>>>>>> For my part, the ideal solution would be to see the whole framework
>>>>>>> be
>>>>>>> based
>>>>>>> on JDK 1.5 and not 1.4.
>>>>>>> 
>>>>>>> Thanks
>>>>>>> 
>>>>>>> Bruce
>>>>>>> 
>>>>>>> 
>>>>>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>>>>>> 
>>>>>>>> 
>>>>>>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>>>>>>> Do you have some advance?
>>>>>>>> Salutations, thanks.
>>>>>>>> Pablo.
>>>>>>>> 
>>>>>>>> 
>>>>>>>> Jackson, Bruce wrote:
>>>>>>>>> 
>>>>>>>>> The Felix site has a useful section on getting things going on
>>>>>>>>> Android
>>>>>>>>> (
>>>>>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html)
>>>>>>>>> but
>>>>>>>>> isn't
>>>>>>>>> so clear about embedding the framework into an Android app"
>>>>>>>>> 
>>>>>>>>> "Apache Felix can also be integrated with an Android application.
>>>>>>>>> To
>>>>>>>>> achieve
>>>>>>>>> this, you need to embed Felix into onCreate() method of your
>>>>>>>>> Activity
>>>>>>>>> class
>>>>>>>>> (see Android docs for more details on how to use an Activity) and
>>>>>>>>> process
>>>>>>>>> your bundles as shown above."
>>>>>>>>> 
>>>>>>>>> Has anyone got an example of how you do this? I understand how to
>>>>>>>>> write
>>>>>>>>> the
>>>>>>>>> Android app, and I get the point being made here. What I need to
>>>>>>>>> understand
>>>>>>>>> is:
>>>>>>>>> 
>>>>>>>>> 1. How do you launch the Felix framework. What do I need to
>>>>>>>>> instantiate?
>>>>>>>>> 2. Where does the framework get its boot configuration (i.e. what
>>>>>>>>> bundles
>>>>>>>>> to
>>>>>>>>> load, run levels, environment variables, etc) from in this case?
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> -- 
>>>>>> Karl Pauls
>>>>>> karlpauls@gmail.com
>>>>>> 
>>>>>> 
>>>> 
>>>> 
>>>> 
>>> 
>>> -- 
>>> View this message in context:
>>> http://old.nabble.com/Felix-on-Android-tp27245141p27597525.html
>>> Sent from the Apache Felix - Dev mailing list archive at Nabble.com.
>>> 
>> 
>> 
>> 
> 
> -- 
> View this message in context: http://old.nabble.com/Felix-on-Android-tp27245141p27612787.html
> Sent from the Apache Felix - Dev mailing list archive at Nabble.com.
> 


Re: Felix on Android

Posted by pablomj <pa...@hotmail.es>.
Hi everyone, I know what is my current problem.

the problem is in this try

    void launchFelix() 
    {
    	Log.d("Felix", "About to start Felix...");
    	// Create a configuration property map
    	String cacheDir = null;
    	//String FELIX_CACHE_DIR =
"/data/data/net.luminis.android.felix/cache";
    	try {
			cacheDir = File.createTempFile("skifta", ".tmp").getParent();
		} catch (IOException e) {
			Log.d("Felix", "unable to create temp file", e);
			return;
		}
.
.
.

Because I don't have permissions to write in the /sdcard directory of the
emulator. So, the program can't create the temp file.

somebody knows how I can add permissions to this directory?
Thanks.





clement escoffier wrote:
> 
> 
> On 15.02.2010, at 18:56, pablomj wrote:
> 
>> 
>> Hi everyone, here are my advances,
>> 
>> I reviewed all steps, I can instanciate a Felix object like in your
>> example.
>> It was a problem with dependencies. 
>> 
>> Proving for install for start and stop a bundle I made in the code:
>> 
>>            BundleContext newBundle = m_felix.getBundleContext();
>>            bb.installBundle(pathOfTheBundle);
>> 
>> When...now my problem is this pathOfTheBundle, I tried put in
>> pathOfTheBundle "/data/felix/EnglishDictionary.jar" (location where I put
>> this bundle with adb push ..... in console )and some variants, but always
>> is
>> an wrong path. What I must express my bundle location?
>> 
>> Can anybody help me? Thanks again. 
> 
> Try with: file:/data/felix//EnglishDictionary.jar. 
> 
> Be also aware that this location is not available on regular devices. For
> such kind of manipulation, you should use the external storage (generally
> /sdcard, but use the Environment class to get the root). (you can also use
> the internal application assets).
> 
> Regards,
> 
> Clement
> 
>> 
>> Regards, Pablo.
>> 
>> 
>> 
>> 
>> Jackson, Bruce wrote:
>>> 
>>> Yes, you can.
>>> 
>>> In the code I sent you, you'll see that you can get a handle to the
>>> BundleContext for the framework itself. From this you can then call:
>>> 
>>> context.installBundle(String location);
>>> 
>>> to install your own bundles.
>>> 
>>> 
>>> On 12/02/2010 15:07, "pablomj" <pa...@hotmail.es> wrote:
>>> 
>>>> 
>>>> Oh, thanks Bruce and Karl for your comments.
>>>> 
>>>> I did something wrong, because I can't instanciate an "Felix" object.
>>>> So,
>>>> I
>>>> am going to review all steps...
>>>> 
>>>> Although I don't see running this yet, I will can start and stop
>>>> bundles
>>>> from my Android application? I excited to view this!
>>>> 
>>>> Regards,
>>>> Pablo.
>>>> 
>>>> 
>>>> Karl Pauls wrote:
>>>>> 
>>>>> Why would you need 1.5 to be able to dex the bundle (the framework
>>>>> itself is build for 1.3 btw.)?
>>>>> 
>>>>> regards,
>>>>> 
>>>>> Karl
>>>>> 
>>>>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce <br...@qualcomm.com>
>>>>> wrote:
>>>>>> Hi Pablo
>>>>>> 
>>>>>> See the attached code. The biggest problem I've encountered is that
>>>>>> the
>>>>>> Felix distribution is a huge pain to build under JDK 1.5, and
>>>>>> therefore
>>>>>> to
>>>>>> be able to use some of the bundles (for example the http service)
>>>>>> that
>>>>>> are
>>>>>> part of the distribution. Its not a simple job of just changing a
>>>>>> couple
>>>>>> of
>>>>>> entries in POM files: some components download pre-built JAR files
>>>>>> from
>>>>>> the
>>>>>> web and explode these, thereby having classes built under 1.4 which
>>>>>> will
>>>>>> not
>>>>>> work when you dexify the bundles.
>>>>>> 
>>>>>> This is something that would be great to see some work done on by the
>>>>>> Felix
>>>>>> community, because while its true that the basic Felix core does and
>>>>>> will
>>>>>> support Android, most of the add-on bundles wont.
>>>>>> 
>>>>>> For my part, the ideal solution would be to see the whole framework
>>>>>> be
>>>>>> based
>>>>>> on JDK 1.5 and not 1.4.
>>>>>> 
>>>>>> Thanks
>>>>>> 
>>>>>> Bruce
>>>>>> 
>>>>>> 
>>>>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>>>>> 
>>>>>>> 
>>>>>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>>>>>> Do you have some advance?
>>>>>>> Salutations, thanks.
>>>>>>> Pablo.
>>>>>>> 
>>>>>>> 
>>>>>>> Jackson, Bruce wrote:
>>>>>>>> 
>>>>>>>> The Felix site has a useful section on getting things going on
>>>>>>>> Android
>>>>>>>> (
>>>>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html)
>>>>>>>> but
>>>>>>>> isn't
>>>>>>>> so clear about embedding the framework into an Android app"
>>>>>>>> 
>>>>>>>> "Apache Felix can also be integrated with an Android application.
>>>>>>>> To
>>>>>>>> achieve
>>>>>>>> this, you need to embed Felix into onCreate() method of your
>>>>>>>> Activity
>>>>>>>> class
>>>>>>>> (see Android docs for more details on how to use an Activity) and
>>>>>>>> process
>>>>>>>> your bundles as shown above."
>>>>>>>> 
>>>>>>>> Has anyone got an example of how you do this? I understand how to
>>>>>>>> write
>>>>>>>> the
>>>>>>>> Android app, and I get the point being made here. What I need to
>>>>>>>> understand
>>>>>>>> is:
>>>>>>>> 
>>>>>>>> 1. How do you launch the Felix framework. What do I need to
>>>>>>>> instantiate?
>>>>>>>> 2. Where does the framework get its boot configuration (i.e. what
>>>>>>>> bundles
>>>>>>>> to
>>>>>>>> load, run levels, environment variables, etc) from in this case?
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> -- 
>>>>> Karl Pauls
>>>>> karlpauls@gmail.com
>>>>> 
>>>>> 
>>> 
>>> 
>>> 
>> 
>> -- 
>> View this message in context:
>> http://old.nabble.com/Felix-on-Android-tp27245141p27597525.html
>> Sent from the Apache Felix - Dev mailing list archive at Nabble.com.
>> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Felix-on-Android-tp27245141p27612787.html
Sent from the Apache Felix - Dev mailing list archive at Nabble.com.


Re: Felix on Android

Posted by Clement Escoffier <cl...@gmail.com>.
On 15.02.2010, at 18:56, pablomj wrote:

> 
> Hi everyone, here are my advances,
> 
> I reviewed all steps, I can instanciate a Felix object like in your example.
> It was a problem with dependencies. 
> 
> Proving for install for start and stop a bundle I made in the code:
> 
>            BundleContext newBundle = m_felix.getBundleContext();
>            bb.installBundle(pathOfTheBundle);
> 
> When...now my problem is this pathOfTheBundle, I tried put in
> pathOfTheBundle "/data/felix/EnglishDictionary.jar" (location where I put
> this bundle with adb push ..... in console )and some variants, but always is
> an wrong path. What I must express my bundle location?
> 
> Can anybody help me? Thanks again. 

Try with: file:/data/felix//EnglishDictionary.jar. 

Be also aware that this location is not available on regular devices. For such kind of manipulation, you should use the external storage (generally /sdcard, but use the Environment class to get the root). (you can also use the internal application assets).

Regards,

Clement

> 
> Regards, Pablo.
> 
> 
> 
> 
> Jackson, Bruce wrote:
>> 
>> Yes, you can.
>> 
>> In the code I sent you, you'll see that you can get a handle to the
>> BundleContext for the framework itself. From this you can then call:
>> 
>> context.installBundle(String location);
>> 
>> to install your own bundles.
>> 
>> 
>> On 12/02/2010 15:07, "pablomj" <pa...@hotmail.es> wrote:
>> 
>>> 
>>> Oh, thanks Bruce and Karl for your comments.
>>> 
>>> I did something wrong, because I can't instanciate an "Felix" object. So,
>>> I
>>> am going to review all steps...
>>> 
>>> Although I don't see running this yet, I will can start and stop bundles
>>> from my Android application? I excited to view this!
>>> 
>>> Regards,
>>> Pablo.
>>> 
>>> 
>>> Karl Pauls wrote:
>>>> 
>>>> Why would you need 1.5 to be able to dex the bundle (the framework
>>>> itself is build for 1.3 btw.)?
>>>> 
>>>> regards,
>>>> 
>>>> Karl
>>>> 
>>>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce <br...@qualcomm.com>
>>>> wrote:
>>>>> Hi Pablo
>>>>> 
>>>>> See the attached code. The biggest problem I've encountered is that the
>>>>> Felix distribution is a huge pain to build under JDK 1.5, and therefore
>>>>> to
>>>>> be able to use some of the bundles (for example the http service) that
>>>>> are
>>>>> part of the distribution. Its not a simple job of just changing a
>>>>> couple
>>>>> of
>>>>> entries in POM files: some components download pre-built JAR files from
>>>>> the
>>>>> web and explode these, thereby having classes built under 1.4 which
>>>>> will
>>>>> not
>>>>> work when you dexify the bundles.
>>>>> 
>>>>> This is something that would be great to see some work done on by the
>>>>> Felix
>>>>> community, because while its true that the basic Felix core does and
>>>>> will
>>>>> support Android, most of the add-on bundles wont.
>>>>> 
>>>>> For my part, the ideal solution would be to see the whole framework be
>>>>> based
>>>>> on JDK 1.5 and not 1.4.
>>>>> 
>>>>> Thanks
>>>>> 
>>>>> Bruce
>>>>> 
>>>>> 
>>>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>>>> 
>>>>>> 
>>>>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>>>>> Do you have some advance?
>>>>>> Salutations, thanks.
>>>>>> Pablo.
>>>>>> 
>>>>>> 
>>>>>> Jackson, Bruce wrote:
>>>>>>> 
>>>>>>> The Felix site has a useful section on getting things going on
>>>>>>> Android
>>>>>>> (
>>>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html)
>>>>>>> but
>>>>>>> isn't
>>>>>>> so clear about embedding the framework into an Android app"
>>>>>>> 
>>>>>>> "Apache Felix can also be integrated with an Android application. To
>>>>>>> achieve
>>>>>>> this, you need to embed Felix into onCreate() method of your Activity
>>>>>>> class
>>>>>>> (see Android docs for more details on how to use an Activity) and
>>>>>>> process
>>>>>>> your bundles as shown above."
>>>>>>> 
>>>>>>> Has anyone got an example of how you do this? I understand how to
>>>>>>> write
>>>>>>> the
>>>>>>> Android app, and I get the point being made here. What I need to
>>>>>>> understand
>>>>>>> is:
>>>>>>> 
>>>>>>> 1. How do you launch the Felix framework. What do I need to
>>>>>>> instantiate?
>>>>>>> 2. Where does the framework get its boot configuration (i.e. what
>>>>>>> bundles
>>>>>>> to
>>>>>>> load, run levels, environment variables, etc) from in this case?
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> 
>>>> -- 
>>>> Karl Pauls
>>>> karlpauls@gmail.com
>>>> 
>>>> 
>> 
>> 
>> 
> 
> -- 
> View this message in context: http://old.nabble.com/Felix-on-Android-tp27245141p27597525.html
> Sent from the Apache Felix - Dev mailing list archive at Nabble.com.
> 


Re: Felix on Android

Posted by pablomj <pa...@hotmail.es>.
Hi everyone, here are my advances,

I reviewed all steps, I can instanciate a Felix object like in your example.
It was a problem with dependencies. 

Proving for install for start and stop a bundle I made in the code:

            BundleContext newBundle = m_felix.getBundleContext();
            bb.installBundle(pathOfTheBundle);

When...now my problem is this pathOfTheBundle, I tried put in
pathOfTheBundle "/data/felix/EnglishDictionary.jar" (location where I put
this bundle with adb push ..... in console )and some variants, but always is
an wrong path. What I must express my bundle location?

Can anybody help me? Thanks again. 

Regards, Pablo.




Jackson, Bruce wrote:
> 
> Yes, you can.
> 
> In the code I sent you, you'll see that you can get a handle to the
> BundleContext for the framework itself. From this you can then call:
> 
> context.installBundle(String location);
> 
> to install your own bundles.
> 
> 
> On 12/02/2010 15:07, "pablomj" <pa...@hotmail.es> wrote:
> 
>> 
>> Oh, thanks Bruce and Karl for your comments.
>> 
>> I did something wrong, because I can't instanciate an "Felix" object. So,
>> I
>> am going to review all steps...
>> 
>> Although I don't see running this yet, I will can start and stop bundles
>> from my Android application? I excited to view this!
>> 
>> Regards,
>> Pablo.
>> 
>> 
>> Karl Pauls wrote:
>>> 
>>> Why would you need 1.5 to be able to dex the bundle (the framework
>>> itself is build for 1.3 btw.)?
>>> 
>>> regards,
>>> 
>>> Karl
>>> 
>>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce <br...@qualcomm.com>
>>> wrote:
>>>> Hi Pablo
>>>> 
>>>> See the attached code. The biggest problem I've encountered is that the
>>>> Felix distribution is a huge pain to build under JDK 1.5, and therefore
>>>> to
>>>> be able to use some of the bundles (for example the http service) that
>>>> are
>>>> part of the distribution. Its not a simple job of just changing a
>>>> couple
>>>> of
>>>> entries in POM files: some components download pre-built JAR files from
>>>> the
>>>> web and explode these, thereby having classes built under 1.4 which
>>>> will
>>>> not
>>>> work when you dexify the bundles.
>>>> 
>>>> This is something that would be great to see some work done on by the
>>>> Felix
>>>> community, because while its true that the basic Felix core does and
>>>> will
>>>> support Android, most of the add-on bundles wont.
>>>> 
>>>> For my part, the ideal solution would be to see the whole framework be
>>>> based
>>>> on JDK 1.5 and not 1.4.
>>>> 
>>>> Thanks
>>>> 
>>>> Bruce
>>>> 
>>>> 
>>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>>> 
>>>>> 
>>>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>>>> Do you have some advance?
>>>>> Salutations, thanks.
>>>>> Pablo.
>>>>> 
>>>>> 
>>>>> Jackson, Bruce wrote:
>>>>>> 
>>>>>> The Felix site has a useful section on getting things going on
>>>>>> Android
>>>>>> (
>>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html)
>>>>>> but
>>>>>> isn't
>>>>>> so clear about embedding the framework into an Android app"
>>>>>> 
>>>>>> "Apache Felix can also be integrated with an Android application. To
>>>>>> achieve
>>>>>> this, you need to embed Felix into onCreate() method of your Activity
>>>>>> class
>>>>>> (see Android docs for more details on how to use an Activity) and
>>>>>> process
>>>>>> your bundles as shown above."
>>>>>> 
>>>>>> Has anyone got an example of how you do this? I understand how to
>>>>>> write
>>>>>> the
>>>>>> Android app, and I get the point being made here. What I need to
>>>>>> understand
>>>>>> is:
>>>>>> 
>>>>>> 1. How do you launch the Felix framework. What do I need to
>>>>>> instantiate?
>>>>>> 2. Where does the framework get its boot configuration (i.e. what
>>>>>> bundles
>>>>>> to
>>>>>> load, run levels, environment variables, etc) from in this case?
>>>>>> 
>>>>>> 
>>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> -- 
>>> Karl Pauls
>>> karlpauls@gmail.com
>>> 
>>> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Felix-on-Android-tp27245141p27597525.html
Sent from the Apache Felix - Dev mailing list archive at Nabble.com.


Re: Felix on Android

Posted by "Jackson, Bruce" <br...@qualcomm.com>.
Yes, you can.

In the code I sent you, you'll see that you can get a handle to the
BundleContext for the framework itself. From this you can then call:

context.installBundle(String location);

to install your own bundles.


On 12/02/2010 15:07, "pablomj" <pa...@hotmail.es> wrote:

> 
> Oh, thanks Bruce and Karl for your comments.
> 
> I did something wrong, because I can't instanciate an "Felix" object. So, I
> am going to review all steps...
> 
> Although I don't see running this yet, I will can start and stop bundles
> from my Android application? I excited to view this!
> 
> Regards,
> Pablo.
> 
> 
> Karl Pauls wrote:
>> 
>> Why would you need 1.5 to be able to dex the bundle (the framework
>> itself is build for 1.3 btw.)?
>> 
>> regards,
>> 
>> Karl
>> 
>> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce <br...@qualcomm.com>
>> wrote:
>>> Hi Pablo
>>> 
>>> See the attached code. The biggest problem I've encountered is that the
>>> Felix distribution is a huge pain to build under JDK 1.5, and therefore
>>> to
>>> be able to use some of the bundles (for example the http service) that
>>> are
>>> part of the distribution. Its not a simple job of just changing a couple
>>> of
>>> entries in POM files: some components download pre-built JAR files from
>>> the
>>> web and explode these, thereby having classes built under 1.4 which will
>>> not
>>> work when you dexify the bundles.
>>> 
>>> This is something that would be great to see some work done on by the
>>> Felix
>>> community, because while its true that the basic Felix core does and will
>>> support Android, most of the add-on bundles wont.
>>> 
>>> For my part, the ideal solution would be to see the whole framework be
>>> based
>>> on JDK 1.5 and not 1.4.
>>> 
>>> Thanks
>>> 
>>> Bruce
>>> 
>>> 
>>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>> 
>>>> 
>>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>>> Do you have some advance?
>>>> Salutations, thanks.
>>>> Pablo.
>>>> 
>>>> 
>>>> Jackson, Bruce wrote:
>>>>> 
>>>>> The Felix site has a useful section on getting things going on Android
>>>>> (
>>>>> http://felix.apache.org/site/apache-felix-and-google-android.html) but
>>>>> isn't
>>>>> so clear about embedding the framework into an Android app"
>>>>> 
>>>>> "Apache Felix can also be integrated with an Android application. To
>>>>> achieve
>>>>> this, you need to embed Felix into onCreate() method of your Activity
>>>>> class
>>>>> (see Android docs for more details on how to use an Activity) and
>>>>> process
>>>>> your bundles as shown above."
>>>>> 
>>>>> Has anyone got an example of how you do this? I understand how to write
>>>>> the
>>>>> Android app, and I get the point being made here. What I need to
>>>>> understand
>>>>> is:
>>>>> 
>>>>> 1. How do you launch the Felix framework. What do I need to
>>>>> instantiate?
>>>>> 2. Where does the framework get its boot configuration (i.e. what
>>>>> bundles
>>>>> to
>>>>> load, run levels, environment variables, etc) from in this case?
>>>>> 
>>>>> 
>>>>> 
>>> 
>>> 
>> 
>> 
>> 
>> -- 
>> Karl Pauls
>> karlpauls@gmail.com
>> 
>> 


Re: Felix on Android

Posted by pablomj <pa...@hotmail.es>.
Oh, thanks Bruce and Karl for your comments.

I did something wrong, because I can't instanciate an "Felix" object. So, I
am going to review all steps...

Although I don't see running this yet, I will can start and stop bundles
from my Android application? I excited to view this!

Regards,
Pablo.


Karl Pauls wrote:
> 
> Why would you need 1.5 to be able to dex the bundle (the framework
> itself is build for 1.3 btw.)?
> 
> regards,
> 
> Karl
> 
> On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce <br...@qualcomm.com>
> wrote:
>> Hi Pablo
>>
>> See the attached code. The biggest problem I've encountered is that the
>> Felix distribution is a huge pain to build under JDK 1.5, and therefore
>> to
>> be able to use some of the bundles (for example the http service) that
>> are
>> part of the distribution. Its not a simple job of just changing a couple
>> of
>> entries in POM files: some components download pre-built JAR files from
>> the
>> web and explode these, thereby having classes built under 1.4 which will
>> not
>> work when you dexify the bundles.
>>
>> This is something that would be great to see some work done on by the
>> Felix
>> community, because while its true that the basic Felix core does and will
>> support Android, most of the add-on bundles wont.
>>
>> For my part, the ideal solution would be to see the whole framework be
>> based
>> on JDK 1.5 and not 1.4.
>>
>> Thanks
>>
>> Bruce
>>
>>
>> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>>
>>>
>>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>>> Do you have some advance?
>>> Salutations, thanks.
>>> Pablo.
>>>
>>>
>>> Jackson, Bruce wrote:
>>>>
>>>> The Felix site has a useful section on getting things going on Android
>>>> (
>>>> http://felix.apache.org/site/apache-felix-and-google-android.html) but
>>>> isn't
>>>> so clear about embedding the framework into an Android app"
>>>>
>>>> "Apache Felix can also be integrated with an Android application. To
>>>> achieve
>>>> this, you need to embed Felix into onCreate() method of your Activity
>>>> class
>>>> (see Android docs for more details on how to use an Activity) and
>>>> process
>>>> your bundles as shown above."
>>>>
>>>> Has anyone got an example of how you do this? I understand how to write
>>>> the
>>>> Android app, and I get the point being made here. What I need to
>>>> understand
>>>> is:
>>>>
>>>> 1. How do you launch the Felix framework. What do I need to
>>>> instantiate?
>>>> 2. Where does the framework get its boot configuration (i.e. what
>>>> bundles
>>>> to
>>>> load, run levels, environment variables, etc) from in this case?
>>>>
>>>>
>>>>
>>
>>
> 
> 
> 
> -- 
> Karl Pauls
> karlpauls@gmail.com
> 
> 

-- 
View this message in context: http://old.nabble.com/Felix-on-Android-tp27245141p27564933.html
Sent from the Apache Felix - Dev mailing list archive at Nabble.com.


Re: Felix on Android

Posted by Karl Pauls <ka...@gmail.com>.
Why would you need 1.5 to be able to dex the bundle (the framework
itself is build for 1.3 btw.)?

regards,

Karl

On Fri, Feb 12, 2010 at 1:15 PM, Jackson, Bruce <br...@qualcomm.com> wrote:
> Hi Pablo
>
> See the attached code. The biggest problem I've encountered is that the
> Felix distribution is a huge pain to build under JDK 1.5, and therefore to
> be able to use some of the bundles (for example the http service) that are
> part of the distribution. Its not a simple job of just changing a couple of
> entries in POM files: some components download pre-built JAR files from the
> web and explode these, thereby having classes built under 1.4 which will not
> work when you dexify the bundles.
>
> This is something that would be great to see some work done on by the Felix
> community, because while its true that the basic Felix core does and will
> support Android, most of the add-on bundles wont.
>
> For my part, the ideal solution would be to see the whole framework be based
> on JDK 1.5 and not 1.4.
>
> Thanks
>
> Bruce
>
>
> On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:
>
>>
>> Hi Bruce, I am trying the same, but I don't have the solution yet.
>> Do you have some advance?
>> Salutations, thanks.
>> Pablo.
>>
>>
>> Jackson, Bruce wrote:
>>>
>>> The Felix site has a useful section on getting things going on Android (
>>> http://felix.apache.org/site/apache-felix-and-google-android.html) but
>>> isn't
>>> so clear about embedding the framework into an Android app"
>>>
>>> "Apache Felix can also be integrated with an Android application. To
>>> achieve
>>> this, you need to embed Felix into onCreate() method of your Activity
>>> class
>>> (see Android docs for more details on how to use an Activity) and process
>>> your bundles as shown above."
>>>
>>> Has anyone got an example of how you do this? I understand how to write
>>> the
>>> Android app, and I get the point being made here. What I need to
>>> understand
>>> is:
>>>
>>> 1. How do you launch the Felix framework. What do I need to instantiate?
>>> 2. Where does the framework get its boot configuration (i.e. what bundles
>>> to
>>> load, run levels, environment variables, etc) from in this case?
>>>
>>>
>>>
>
>



-- 
Karl Pauls
karlpauls@gmail.com

Re: Felix on Android

Posted by "Jackson, Bruce" <br...@qualcomm.com>.
Hi Pablo

See the attached code. The biggest problem I've encountered is that the
Felix distribution is a huge pain to build under JDK 1.5, and therefore to
be able to use some of the bundles (for example the http service) that are
part of the distribution. Its not a simple job of just changing a couple of
entries in POM files: some components download pre-built JAR files from the
web and explode these, thereby having classes built under 1.4 which will not
work when you dexify the bundles.

This is something that would be great to see some work done on by the Felix
community, because while its true that the basic Felix core does and will
support Android, most of the add-on bundles wont.

For my part, the ideal solution would be to see the whole framework be based
on JDK 1.5 and not 1.4.

Thanks

Bruce


On 12/02/2010 11:32, "pablomj" <pa...@hotmail.es> wrote:

> 
> Hi Bruce, I am trying the same, but I don't have the solution yet.
> Do you have some advance?
> Salutations, thanks.
> Pablo.
> 
> 
> Jackson, Bruce wrote:
>> 
>> The Felix site has a useful section on getting things going on Android (
>> http://felix.apache.org/site/apache-felix-and-google-android.html) but
>> isn't
>> so clear about embedding the framework into an Android app"
>> 
>> "Apache Felix can also be integrated with an Android application. To
>> achieve
>> this, you need to embed Felix into onCreate() method of your Activity
>> class
>> (see Android docs for more details on how to use an Activity) and process
>> your bundles as shown above."
>> 
>> Has anyone got an example of how you do this? I understand how to write
>> the
>> Android app, and I get the point being made here. What I need to
>> understand
>> is:
>> 
>> 1. How do you launch the Felix framework. What do I need to instantiate?
>> 2. Where does the framework get its boot configuration (i.e. what bundles
>> to
>> load, run levels, environment variables, etc) from in this case?
>> 
>> 
>>