You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by Pedro Domingues <pe...@ist.utl.pt> on 2015/09/12 21:31:36 UTC

Need help debugging Felix OSGi bundles (with Eclipse)

Hi,

I really need to debug my code by the use of breakpoints, however this 
seems a complex undertaking with an OSGi container.

I have Eclipse and Felix (both the latest). My project is a raw OSGi 
project, I am not using PDE, just maven bundle plugin to generate the 
bundles and then copy them to the /bundle folder in felix, then I 
perform java -jar bin/felix.jar and the project runs. So no fuss here.

However I cannot debug the application that way. I've tried to read the 
docs 
(http://felix.apache.org/documentation/development/integrating-felix-with-eclipse.html) 
but they are outdated/broken and cant make them work...

How can I debug this? Will I have to avoid using OSGi just because debug 
is not supported...? :(

Thanks!

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Need help debugging Felix OSGi bundles (with Eclipse)

Posted by Christian Schneider <ch...@die-schneider.net>.
I just followed the tutorial on the  bndtools site.
I think they do not explicitly describe debug as it just works like in a 
non OSGi eclipse project.

You just start the launcher project in debug mode and can work with your 
break points.
One nice thing is that you can simply change source, save and continue 
debugging in the running session.

The above is also possible in karaf with remote debug and bundle:watch * 
but less convenient as you have to do a maven build on the changed
projects.


Christian

Am 13.09.2015 um 09:52 schrieb Pedro Domingues:
> Is there a tutorial showing how to achieve that with bndtools?
>
> On September 12, 2015 10:01:20 PM WEST, Christian Schneider <ch...@die-schneider.net> wrote:
>> If you only need plain felix then eclipse + bndtools might help.
>>
>> I just tried the new 3.0.0 version and was able to setup as small
>> project in quite short time.
>> It features very nice debug integration.
>>
>> Apart from this remote debugging always works but is less convenient.
>>
>> Christian
>>
>> Am 12.09.2015 um 21:31 schrieb Pedro Domingues:
>>> Hi,
>>>
>>> I really need to debug my code by the use of breakpoints, however
>> this
>>> seems a complex undertaking with an OSGi container.
>>>
>>> I have Eclipse and Felix (both the latest). My project is a raw OSGi
>>> project, I am not using PDE, just maven bundle plugin to generate the
>>> bundles and then copy them to the /bundle folder in felix, then I
>>> perform java -jar bin/felix.jar and the project runs. So no fuss
>> here.
>>> However I cannot debug the application that way. I've tried to read
>>> the docs
>>>
>> (http://felix.apache.org/documentation/development/integrating-felix-with-eclipse.html)
>>
>>> but they are outdated/broken and cant make them work...
>>>
>>> How can I debug this? Will I have to avoid using OSGi just because
>>> debug is not supported...? :(
>>>
>>> Thanks!
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>>> For additional commands, e-mail: users-help@felix.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Need help debugging Felix OSGi bundles (with Eclipse)

Posted by Pedro Domingues <pe...@ist.utl.pt>.
Is there a tutorial showing how to achieve that with bndtools? 

On September 12, 2015 10:01:20 PM WEST, Christian Schneider <ch...@die-schneider.net> wrote:
>If you only need plain felix then eclipse + bndtools might help.
>
>I just tried the new 3.0.0 version and was able to setup as small 
>project in quite short time.
>It features very nice debug integration.
>
>Apart from this remote debugging always works but is less convenient.
>
>Christian
>
>Am 12.09.2015 um 21:31 schrieb Pedro Domingues:
>> Hi,
>>
>> I really need to debug my code by the use of breakpoints, however
>this 
>> seems a complex undertaking with an OSGi container.
>>
>> I have Eclipse and Felix (both the latest). My project is a raw OSGi 
>> project, I am not using PDE, just maven bundle plugin to generate the
>
>> bundles and then copy them to the /bundle folder in felix, then I 
>> perform java -jar bin/felix.jar and the project runs. So no fuss
>here.
>>
>> However I cannot debug the application that way. I've tried to read 
>> the docs 
>>
>(http://felix.apache.org/documentation/development/integrating-felix-with-eclipse.html)
>
>> but they are outdated/broken and cant make them work...
>>
>> How can I debug this? Will I have to avoid using OSGi just because 
>> debug is not supported...? :(
>>
>> Thanks!
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>For additional commands, e-mail: users-help@felix.apache.org

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Re: Need help debugging Felix OSGi bundles (with Eclipse)

Posted by Neil Bartlett <nj...@gmail.com>.
Pedro,

You are using an unstable, alpha version of Bndtools. Please install the
latest stable release, version 3.0, by following the instructions at:
http://bndtools.org/installation.html

Also I strongly recommend following the tutorial first so you get an
understanding of bnd(tools) concepts: http://bndtools.org/tutorial.html

Regards,
Neil

PS: "I am being slaughtered without mercy"?? Please, stop.

On Sun, Sep 13, 2015 at 11:11 AM, Pedro Domingues <
pedro.domingues@ist.utl.pt> wrote:

> I am trying with bndtools but I am being slaughtered without mercy.
>
> I have like 30 bundles or so. I choose one of the main bundles and
> followed these instructions (
> http://bndtools.org/tutorial.html#run-an-osgi-framework), he created a
> *.bndrun* file in my bundle's root directory with the following:
>
> *-runfw: org.apache.felix.framework;version='[4,5)'*
> *-runee: JavaSE-1.7*
> *-runsystemcapabilities: ${native_capability}*
>
> *-resolve.effective: active;skip:="osgi.service"*
>
> However this happens when I try to edit the file in Eclipse:
>
> [image: http://i.imgur.com/FYKDnvE.png]
>
> However this looks a bit far from what I want. It seems this .bndrun will
> import a felix.jar from somewhere else, but in fact I want to use the one I
> have in C:\code\osgi_proj\deploy\bin\felix.jar because I already have there
> all the bundles I need and the configurations (unless for some debugging
> limitation eclipse needs to directly inject the bundles).
>
> Can this be done, or I will need to deeply modify my project in order for
> this to work?
>
> Thanks!
>
>
>
> On 12/09/2015 22:01, Christian Schneider wrote:
>
> If you only need plain felix then eclipse + bndtools might help.
>
> I just tried the new 3.0.0 version and was able to setup as small project
> in quite short time.
> It features very nice debug integration.
>
> Apart from this remote debugging always works but is less convenient.
>
> Christian
>
> Am 12.09.2015 um 21:31 schrieb Pedro Domingues:
>
> Hi,
>
> I really need to debug my code by the use of breakpoints, however this
> seems a complex undertaking with an OSGi container.
>
> I have Eclipse and Felix (both the latest). My project is a raw OSGi
> project, I am not using PDE, just maven bundle plugin to generate the
> bundles and then copy them to the /bundle folder in felix, then I perform
> java -jar bin/felix.jar and the project runs. So no fuss here.
>
> However I cannot debug the application that way. I've tried to read the
> docs (
> http://felix.apache.org/documentation/development/integrating-felix-with-eclipse.html)
> but they are outdated/broken and cant make them work...
>
> How can I debug this? Will I have to avoid using OSGi just because debug
> is not supported...? :(
>
> Thanks!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>
>

Re: Need help debugging Felix OSGi bundles (with Eclipse)

Posted by Pedro Domingues <pe...@ist.utl.pt>.
I am trying with bndtools but I am being slaughtered without mercy.

I have like 30 bundles or so. I choose one of the main bundles and 
followed these instructions 
(http://bndtools.org/tutorial.html#run-an-osgi-framework), he created a 
*.bndrun* file in my bundle's root directory with the following:

/-runfw: org.apache.felix.framework;version='[4,5)'//
//-runee: JavaSE-1.7//
//-runsystemcapabilities: ${native_capability}//
//
//-resolve.effective: active;skip:="osgi.service"/

However this happens when I try to edit the file in Eclipse:

http://i.imgur.com/FYKDnvE.png

However this looks a bit far from what I want. It seems this .bndrun 
will import a felix.jar from somewhere else, but in fact I want to use 
the one I have in C:\code\osgi_proj\deploy\bin\felix.jar because I 
already have there all the bundles I need and the configurations (unless 
for some debugging limitation eclipse needs to directly inject the bundles).

Can this be done, or I will need to deeply modify my project in order 
for this to work?

Thanks!


On 12/09/2015 22:01, Christian Schneider wrote:
> If you only need plain felix then eclipse + bndtools might help.
>
> I just tried the new 3.0.0 version and was able to setup as small 
> project in quite short time.
> It features very nice debug integration.
>
> Apart from this remote debugging always works but is less convenient.
>
> Christian
>
> Am 12.09.2015 um 21:31 schrieb Pedro Domingues:
>> Hi,
>>
>> I really need to debug my code by the use of breakpoints, however 
>> this seems a complex undertaking with an OSGi container.
>>
>> I have Eclipse and Felix (both the latest). My project is a raw OSGi 
>> project, I am not using PDE, just maven bundle plugin to generate the 
>> bundles and then copy them to the /bundle folder in felix, then I 
>> perform java -jar bin/felix.jar and the project runs. So no fuss here.
>>
>> However I cannot debug the application that way. I've tried to read 
>> the docs 
>> (http://felix.apache.org/documentation/development/integrating-felix-with-eclipse.html) 
>> but they are outdated/broken and cant make them work...
>>
>> How can I debug this? Will I have to avoid using OSGi just because 
>> debug is not supported...? :(
>>
>> Thanks!
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>


Re: Need help debugging Felix OSGi bundles (with Eclipse)

Posted by Christian Schneider <ch...@die-schneider.net>.
If you only need plain felix then eclipse + bndtools might help.

I just tried the new 3.0.0 version and was able to setup as small 
project in quite short time.
It features very nice debug integration.

Apart from this remote debugging always works but is less convenient.

Christian

Am 12.09.2015 um 21:31 schrieb Pedro Domingues:
> Hi,
>
> I really need to debug my code by the use of breakpoints, however this 
> seems a complex undertaking with an OSGi container.
>
> I have Eclipse and Felix (both the latest). My project is a raw OSGi 
> project, I am not using PDE, just maven bundle plugin to generate the 
> bundles and then copy them to the /bundle folder in felix, then I 
> perform java -jar bin/felix.jar and the project runs. So no fuss here.
>
> However I cannot debug the application that way. I've tried to read 
> the docs 
> (http://felix.apache.org/documentation/development/integrating-felix-with-eclipse.html) 
> but they are outdated/broken and cant make them work...
>
> How can I debug this? Will I have to avoid using OSGi just because 
> debug is not supported...? :(
>
> Thanks!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Need help debugging Felix OSGi bundles (with Eclipse)

Posted by Daniel McGreal <d....@gmail.com>.
Hi, you should investigate "remote debug" with Eclipse which involves starting Java with some parameters and creating a Debug Configuration in Eclipse. 

> On 12 Sep 2015, at 20:31, Pedro Domingues <pe...@ist.utl.pt> wrote:
> 
> Hi,
> 
> I really need to debug my code by the use of breakpoints, however this seems a complex undertaking with an OSGi container.
> 
> I have Eclipse and Felix (both the latest). My project is a raw OSGi project, I am not using PDE, just maven bundle plugin to generate the bundles and then copy them to the /bundle folder in felix, then I perform java -jar bin/felix.jar and the project runs. So no fuss here.
> 
> However I cannot debug the application that way. I've tried to read the docs (http://felix.apache.org/documentation/development/integrating-felix-with-eclipse.html) but they are outdated/broken and cant make them work...
> 
> How can I debug this? Will I have to avoid using OSGi just because debug is not supported...? :(
> 
> Thanks!
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Need help debugging Felix OSGi bundles (with Eclipse)

Posted by de...@mobigov.com.
 

sorry. I thought the was the example being given for karaf-boot. 

On 2015-09-12 16:48, development@mobigov.com wrote: 

> Debug with breakpoints works ok for me, I run karaf with the debug
> option and attach the same I would a tomcat app. I will say that
> somewhere I lost something because even though the ide stops at the
> correct line of the breakpoint and I can see the variables I am
> watching. The libraries included from the ide don't match with what is
> loaded because I do not get the green line and step into and over don't
> work. I also can debug with paxexam but I think OSGI is definitely much
> harder than many other technologies. I don't have a problem with this
> though. I chose java even though it is much harder to pickup than
> dynamic languages. I like type safe languages because even though there
> is more work involved in specifying the rules and it is slower to get
> started. Cleanly specifying the rules allows for better tool support and
> is priceless once a project gets large. I feel the same way about OSGI.
> It is more work upfront but once you really know what you are doing it
> saves a lot of work in the long run. It would be great if things were
> easier at no expense but that is not what drew me to karaf. Also you
> will be competing against many commercial entities for users who are
> looking for easy enterprise and distributed computing (Typesafe, Spring
> ...) so I am not sure that is the way to get more people involved. I
> think concentrating on the type of person who is willing to take the
> time to learn and configure their project so they have an optimal
> solution for the long term would probably pull in more people. 
> 
> On 2015-09-12 15:31, Pedro Domingues wrote:
> 
>> Hi, I really need to debug my code by the use of breakpoints, however this seems a complex undertaking with an OSGi container. I have Eclipse and Felix (both the latest). My project is a raw OSGi project, I am not using PDE, just maven bundle plugin to generate the bundles and then copy them to the /bundle folder in felix, then I perform java -jar bin/felix.jar and the project runs. So no fuss here. However I cannot debug the application that way. I've tried to read the docs (http://felix.apache.org/documentation/development/integrating-felix-with-eclipse.html [1] [1 [1]]) but they are outdated/broken and cant make them work... How can I debug this? Will I have to avoid using OSGi just because debug is not supported...? :( Thanks! --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@felix.apache.org For additional commands, e-mail: users-help@felix.apache.org
> 
> Links:
> ------
> [1]
> http://felix.apache.org/documentation/development/integrating-felix-with-eclipse.html [1]
 

Links:
------
[1]
http://felix.apache.org/documentation/development/integrating-felix-with-eclipse.html

Re: Need help debugging Felix OSGi bundles (with Eclipse)

Posted by de...@mobigov.com.
 

Debug with breakpoints works ok for me, I run karaf with the debug
option and attach the same I would a tomcat app. I will say that
somewhere I lost something because even though the ide stops at the
correct line of the breakpoint and I can see the variables I am
watching. The libraries included from the ide don't match with what is
loaded because I do not get the green line and step into and over don't
work. I also can debug with paxexam but I think OSGI is definitely much
harder than many other technologies. I don't have a problem with this
though. I chose java even though it is much harder to pickup than
dynamic languages. I like type safe languages because even though there
is more work involved in specifying the rules and it is slower to get
started. Cleanly specifying the rules allows for better tool support and
is priceless once a project gets large. I feel the same way about OSGI.
It is more work upfront but once you really know what you are doing it
saves a lot of work in the long run. It would be great if things were
easier at no expense but that is not what drew me to karaf. Also you
will be competing against many commercial entities for users who are
looking for easy enterprise and distributed computing (Typesafe, Spring
...) so I am not sure that is the way to get more people involved. I
think concentrating on the type of person who is willing to take the
time to learn and configure their project so they have an optimal
solution for the long term would probably pull in more people. 

On 2015-09-12 15:31, Pedro Domingues wrote: 

> Hi,
> 
> I really need to debug my code by the use of breakpoints, however this seems a complex undertaking with an OSGi container.
> 
> I have Eclipse and Felix (both the latest). My project is a raw OSGi project, I am not using PDE, just maven bundle plugin to generate the bundles and then copy them to the /bundle folder in felix, then I perform java -jar bin/felix.jar and the project runs. So no fuss here.
> 
> However I cannot debug the application that way. I've tried to read the docs (http://felix.apache.org/documentation/development/integrating-felix-with-eclipse.html [1]) but they are outdated/broken and cant make them work...
> 
> How can I debug this? Will I have to avoid using OSGi just because debug is not supported...? :(
> 
> Thanks!
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
 

Links:
------
[1]
http://felix.apache.org/documentation/development/integrating-felix-with-eclipse.html

Re: Need help debugging Felix OSGi bundles (with Eclipse)

Posted by Neil Bartlett <nj...@gmail.com>.
Debugging of OSGi runtimes is of course possible, and I have never had a problem with it — aside from the occasion difficulty in tracking down source code for third-party dependencies.

What IDE or tool would you usually use to debug a Java application?

Neil


> On 12 Sep 2015, at 20:31, Pedro Domingues <pe...@ist.utl.pt> wrote:
> 
> Hi,
> 
> I really need to debug my code by the use of breakpoints, however this seems a complex undertaking with an OSGi container.
> 
> I have Eclipse and Felix (both the latest). My project is a raw OSGi project, I am not using PDE, just maven bundle plugin to generate the bundles and then copy them to the /bundle folder in felix, then I perform java -jar bin/felix.jar and the project runs. So no fuss here.
> 
> However I cannot debug the application that way. I've tried to read the docs (http://felix.apache.org/documentation/development/integrating-felix-with-eclipse.html) but they are outdated/broken and cant make them work...
> 
> How can I debug this? Will I have to avoid using OSGi just because debug is not supported...? :(
> 
> Thanks!
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: Need help debugging Felix OSGi bundles (with Eclipse)

Posted by Pedro Domingues <pe...@ist.utl.pt>.
Didn't try that. Isn't that too overkill? Does it work exactly as a normal debug in eclipse? 

On September 12, 2015 9:35:03 PM WEST, Benson Margulies <be...@basistech.com> wrote:
>What goes wrong when you add:
>
>-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005
>
>to the java command line and then attach from Eclipse?
>
>
>On Sat, Sep 12, 2015 at 3:31 PM, Pedro Domingues
><pe...@ist.utl.pt> wrote:
>> Hi,
>>
>> I really need to debug my code by the use of breakpoints, however
>this seems
>> a complex undertaking with an OSGi container.
>>
>> I have Eclipse and Felix (both the latest). My project is a raw OSGi
>> project, I am not using PDE, just maven bundle plugin to generate the
>> bundles and then copy them to the /bundle folder in felix, then I
>perform
>> java -jar bin/felix.jar and the project runs. So no fuss here.
>>
>> However I cannot debug the application that way. I've tried to read
>the docs
>>
>(http://felix.apache.org/documentation/development/integrating-felix-with-eclipse.html)
>> but they are outdated/broken and cant make them work...
>>
>> How can I debug this? Will I have to avoid using OSGi just because
>debug is
>> not supported...? :(
>>
>> Thanks!
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>> For additional commands, e-mail: users-help@felix.apache.org
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
>For additional commands, e-mail: users-help@felix.apache.org

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Re: Need help debugging Felix OSGi bundles (with Eclipse)

Posted by Benson Margulies <be...@basistech.com>.
What goes wrong when you add:

-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005

to the java command line and then attach from Eclipse?


On Sat, Sep 12, 2015 at 3:31 PM, Pedro Domingues
<pe...@ist.utl.pt> wrote:
> Hi,
>
> I really need to debug my code by the use of breakpoints, however this seems
> a complex undertaking with an OSGi container.
>
> I have Eclipse and Felix (both the latest). My project is a raw OSGi
> project, I am not using PDE, just maven bundle plugin to generate the
> bundles and then copy them to the /bundle folder in felix, then I perform
> java -jar bin/felix.jar and the project runs. So no fuss here.
>
> However I cannot debug the application that way. I've tried to read the docs
> (http://felix.apache.org/documentation/development/integrating-felix-with-eclipse.html)
> but they are outdated/broken and cant make them work...
>
> How can I debug this? Will I have to avoid using OSGi just because debug is
> not supported...? :(
>
> Thanks!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org