-
1. Re: How can I debug in eclipse with JBoss OSGI?
bosschaert Jul 8, 2010 4:06 AM (in response to ch21)What I always do is run the JVM that runs JBoss OSGi in debug mode. After that you can simply attach the Eclipse Debugger to the process.
So, beginning from the very start, you can do this:
1. To develop a standard OSGi Bundle in Eclipse, create a plugin-project with as 'Target Platform' a standard OSGi Framework:
2. Finish the wizard some code for your bundle...
3. To be able to deploy it in JBoss OSGi, export it as a deployable plugin:
4. Launch JBoss OSGi with the Java debug Agent enabled:
$ export JAVA_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:7777
$ bin/run.sh
5. Attach the debugger to port 7777:
and set a breakpoint in your bundle source code, for instance in its Activator.
6. Install and start your bundle in JBoss OSGi (e.g. through the web console) - you will see that you are in the debugger now at your breakpoint.
Hope this answers your questsion.
David
-
2. Re: How can I debug in eclipse with JBoss OSGI?
ch21 Jul 8, 2010 5:36 AM (in response to bosschaert)I don't know whether I really understand what you mean.You mean, man must first export Bundle in Jar. And then install and start bundle in JBossOSGI. With romote debug in Eclipse can I know, how run my bundle. There are not good. If I hava correct my bundles thousend times, I must export from bundle in thousend jar.If not, in romote java App can I select just onlz a bundle. But I have more bundles. How can I do that?David, thanks for your Reply.chen -
3. Re: How can I debug in eclipse with JBoss OSGI?
bosschaert Jul 8, 2010 6:05 AM (in response to ch21)Hi Chen,
chen huang wrote:
You mean, man must first export Bundle in Jar. And then install and start bundle in JBossOSGI.Yes - I think that's the only way you can do it, but this can be very easy and quick to do. You can save the 'export bundle' action in an ant build.xml script. This script produces a bundle file that you can easily copy to the JBoss OSGi runtime/server/default/deploy directory. That copy action will install and start the bundle. You can put these actions in a script so that you can perform them easily and quickly.
If not, in romote java App can I select just onlz a bundle. But I have more bundles. How can I do that?
David, thanks for your Reply.chenYou mean in Eclipse you need to specify the project in the Debug Configuration screen? AFAIK that's only to associate the correct source code. If you need to debug multiple bundles in a single session you can attach their source code quite easily so it doesn't actually matter that much which project you specified in the run configuration
-
4. Re: How can I debug in eclipse with JBoss OSGI?
ch21 Jul 8, 2010 7:40 AM (in response to bosschaert)thank for your reply. Full untersand.
Now I must lernen Ant and write an Ant-script for my bundles.
There are special requirements for OSGI-Bundle in Ant?
Best Regard
chen
-
5. Re: How can I debug in eclipse with JBoss OSGI?
bosschaert Jul 8, 2010 7:43 AM (in response to ch21)You don't really have to learn ant. You can simply execute the ant script that was generated by the export from within eclipse. It simply performs the same task again.
For copying the bundle to the deploy directory you can use any scripting language you like. It doesn't have to be ant at all...
-
6. Re: How can I debug in eclipse with JBoss OSGI?
ch21 Jul 12, 2010 7:32 AM (in response to bosschaert)Met you, I am so lucky, I unterstand your mean. but my superviser let me use Ant. And I can't use eclipse plugin-project to create bundle. I must develop bundle in normal java project to create bundle.
Development in normal java project is difference to Development in plugin-project. He think structure of project is following:
project name: authorization
src/authorization/java/....(source code)
/META-INF/MENIFEST.MF
/ .......hbm.xml
build.xml
test/...
all dependenced jars must configure in class path. If I have forgot some Import-package in MENIFEST.MF, I can find Error no more in Eclipse. There are not good. But I have not alternative. Do you have some suggestion for me?
Thank very much!!!
Best Regard!
Chen
-
7. Re: How can I debug in eclipse with JBoss OSGI?
bosschaert Jul 8, 2010 11:39 AM (in response to ch21)chen huang wrote:
You can use a free tool called Bnd (http://www.aqute.biz/Code/Bnd) to automatically generate the bundle manifest (including the Import-Package statements) for you.
It also has a really good maven integration: http://felix.apache.org/site/apache-felix-maven-bundle-plugin-bnd.html
Hope this helps,
David
-
8. Re: How can I debug in eclipse with JBoss OSGI?
ch21 Jul 8, 2010 11:52 AM (in response to bosschaert)Thanks for your suggestion.
I am clear.
Thanks!!!
Best Regard!!!
chen