Reputation: 3086
Our app has migrated to OSGi, but I have trouble starting/debugging it in Eclipse. What is the process: is OSGi application developer expected to set up Equinox environment, install hundreds of bundles (jar=bundle?), and start from console? In other words, is launching "hot-plug-gifted" application different from "modular-challenged" one?
Secondary, more concrete question. There is a bootstrap bundle which is supposed to take care of everything, but after loading bunch of classes it slows down and almost hangs at:
...
...
...
Flat profile of 0.22 secs (16 total ticks): main
Interpreted + native Method
16.7% 1 + 0 java.awt.Toolkit.addAWTEventLi[Loaded java.awt.SentEvent from C:\Program Files\Java\jdk1.7.0_04\jre\lib\rt.jar]
stener
16.7% 1 + 0 jav[Loaded java.awt.DefaultKeyboardFocusManager$DefaultKeyboardFocusManagerSentEvent from C:\Program Files\Java\jdk1.7.0_04\jre\lib\rt.jar]
a.util.regex.Pattern.compile
16.7% 1 + 0 sun.util.logging.PlatformLogger.<init>
50.0% 3 + 0 Total interpreted
Thread-local ticks:
62.5% 10 Blocked (of total)
50.0% 3 Class loader
...
...
...
[Loaded sun.reflect.Label$PatchInfo from C:\Program Files\Java\jdk1.7.0_04\jre\lib\rt.jar]
[Loaded sun.reflect.MethodAccessorGenerator$1 from C:\Program Files\Java\jdk1.7.0_04\jre\lib\rt.jar]
[Loaded sun.reflect.ClassDefiner from C:\Program Files\Java\jdk1.7.0_04\jre\lib\rt.jar]
[Loaded sun.reflect.ClassDefiner$1 from C:\Program Files\Java\jdk1.7.0_04\jre\lib\rt.jar]
[Loaded sun.reflect.GeneratedMethodAccessor1 from __JVM_DefineClass__]
[Dynamic-linking native method sun.java2d.DefaultDisposerRecord.invokeNativeDispose ... JNI]
[Dynamic-linking native method java.lang.ref.Finalizer.invokeFinalizeMethod ... JNI]
Edit: progressed a little since question posting
[Loaded sun.reflect.GeneratedMethodAccessor1 from __JVM_DefineClass__]
[Dynamic-linking native method sun.java2d.DefaultDisposerRecord.invokeNativeDispose ... JNI]
[Dynamic-linking native method java.lang.ref.Finalizer.invokeFinalizeMethod ... JNI]
--- new stuff ---
[Loaded sun.awt.windows.WComponentPeer$2 from C:\Program Files\Java\jdk1.7.0_04\jre\lib\rt.jar]
[Dynamic-linking native method sun.awt.windows.WInputMethod.disableNativeIME ... JNI]
Thus it is not a deadlock, what might make it so excrutiatingly slow?
Upvotes: 6
Views: 6830
Reputation: 11482
Launching and debugging in Eclipse should be fairly staightforward. The trick (in my view) is to realise that all the Eclipse support you need is labelled 'plug-in' instead of 'OSGi'. Set up a target platform with all the external bundles you need - you can just dump them into a directory and then point the target platform configurator at that folder. The target platform configuration is under Preferences->Plug-in Development->Target Platform. You can share the target platform as a .target
file. Having a good target platform helps with both running and compiling.
To run your bundles, right click and choose Run as ->OSGi Framework (or debug as). You can tweak which bundles are included in the runtime configuration, and what arguments are used. You may for example want to add -console
. You can also create an application for export, which will give you a config.ini
file. Once you have a config.ini
, your bundles will be pre-installed on Equinox startup.
Upvotes: 5