How to start bundles in proper order [message #929894] |
Mon, 01 October 2012 17:39  |
Eclipse User |
|
|
|
Hello,
I have an issue with starting equinox application from Eclipse IDE. I can't get bundles to start in proper order. It seems that this error does not occur all the time. Sometimes when I create a new launch configuration and select all of the required bundles, I get application running correctly.
My test application uses Apache Aries. I have additionally two projects, one, that contains blueprint.xml that registers some objects in JNDI and second one is a test client. What I need is to start bundles in following order:
1. all of the required Equinox bundles
2. then Apache aries bundles
3. then my component with blueprint.xml
4. then my test application
Instead I have following order of bundles:
ss
"Framework is launched."
id State Bundle
0 ACTIVE org.eclipse.osgi_3.8.0.v20120123-1419
2 ACTIVE org.eclipse.core.commands_3.6.0.v20111007-1312
3 ACTIVE org.apache.aries.jndi_1.0.0
4 ACTIVE org.eclipse.osgi.services_3.3.0.v20111117-1210
5 RESOLVED com.mc.logback.fragment_1.0.0.qualifier
Master=7
6 ACTIVE javax.jms_1.1.0.v200906010428
7 ACTIVE ch.qos.logback.classic_1.0.7
Fragments=5
8 ACTIVE ch.qos.logback.core_1.0.7
9 ACTIVE org.apache.aries.proxy_1.0.0
10 ACTIVE slf4j.api_1.6.4
11 ACTIVE org.apache.felix.gogo.runtime_0.8.0.v201108120515
12 ACTIVE org.eclipse.equinox.common_3.6.100.v20120120-1540
13 ACTIVE blueprint.jms.activemq.registration_1.0.0.qualifier
14 ACTIVE org.apache.activemq.kahadb_5.6.0
15 ACTIVE org.apache.aries.util_1.0.0
16 ACTIVE org.apache.activemq.activemq-core_5.6.0
17 ACTIVE org.apache.geronimo.specs.geronimo-jms_1.1_spec_1.1.1
18 ACTIVE org.eclipse.equinox.console_1.0.0.v20111215-1210
19 ACTIVE org.apache.geronimo.specs.geronimo-j2ee-management_1.1_spec_1.0.1
20 ACTIVE org.apache.aries.blueprint_1.0.0
21 ACTIVE org.apache.felix.gogo.command_0.8.0.v201108120515
22 ACTIVE org.apache.felix.gogo.shell_0.8.0.v201110170705
23 RESOLVED blueprint.jms.activemq.test_1.0.0.qualifier
My component is inside blueprint.jms.activemq.registration_1.0.0 (id=13) and my test application is blueprint.jms.activemq.test_1.0.0 (23).
My test application should be registered by org.apache.aries.jndi (id=3) and org.apache.aries.blueprint (20), but my component is in the middle (13).
Right now I get some errors caused by not registering my component by aries properly.
When I "stop 13" & "stop 23" & "start 13" & "start 23" everything goes right.
I also tried to play with start levels (set start level for all apache aries to 3, my component to 4 and client to 5) but it did not solve the problem.
How can I force start order of my bundles inside Eclipse IDE (I use Run->Run Configurations->OSGi Framework)?
When I use Equinox standalone (directly from console, with config.ini) everything is ok.
[Updated on: Mon, 01 October 2012 17:40] by Moderator
|
|
|
|
|
Re: How to start bundles in proper order [message #933307 is a reply to message #929894] |
Thu, 04 October 2012 19:15  |
Eclipse User |
|
|
|
Hello Thomas,
thank you very much for your answer.
First of all: I couldn't get start level to work as I wanted to. It seems that Eclipse Launcher does not always respects start level.
I agree, that using start levels is a bad practice and it should be used at last resort.
Secondly, I solved my problem. Actually the problem was that Apache Aries starts a background thread and may register components later, after whole framework has started. My bundle had an Activator that tried to get service by using BundleContext.getServiceReference, but since Aries registered it later than my activator ran, so I had problems. So the solution was to use service tracker or use blueprint for my client. Right now it runs fine.
|
|
|
Powered by
FUDForum. Page generated in 0.06327 seconds