I would start with inspecting the produced bundle (Jar), especially the 
manifest and the service descriptors. Maybe you have two conflicting maven 
plugins?

Gruss
Bernd
--
http://bernd.eckenfels.net
________________________________
From: osgi-dev-boun...@mail.osgi.org <osgi-dev-boun...@mail.osgi.org> on behalf 
of Erwin Hogeweg via osgi-dev <osgi-dev@mail.osgi.org>
Sent: Friday, January 19, 2018 12:44:45 AM
To: OSGi Developer Mail List
Subject: [osgi-dev] Stumped - Unexpected duplicate component instantiation.

Hi,

I have a very simple component, with only one method, which is referenced in 
only one other component. For some reason though, the OSGi framework decides 
that the component needs to be instantiated and registered twice. I have put 
breakpoints in the constructor and in both cases the entire stack is framework 
code.

If I add the immediate=true property to the component definition both 
components are actually active, if I leave out the immediate=true one component 
is active the other satisfied.

This is my simple component def.
@Component(name=“my.component",
    configurationPolicy=ConfigurationPolicy.REQUIRE,
    service=MyService.class)

src:list shows them both.
 [ 112]   my.component  enabled
    [  31] [active      ] my.component
...
 [ 137]   my.component  enabled
    [  32] [satisfied   ] my.component


We are using a std equinox/felix OSGi stack.
0 ACTIVE      org.eclipse.osgi_3.10.2.v20150203-1939
            Fragments=5
1 ACTIVE      org.apache.felix.gogo.command_0.16.0
2 ACTIVE      org.apache.felix.gogo.runtime_0.16.2
3 ACTIVE      org.apache.felix.gogo.shell_0.12.0
4 ACTIVE      org.eclipse.equinox.console_1.0.100.v20130429-0953
5 RESOLVED    org.eclipse.osgi.compatibility.state_1.0.100.v20150402-1551
            Master=0
6 ACTIVE      org.ops4j.pax.logging.pax-logging-api_1.8.5
7 ACTIVE      org.ops4j.pax.logging.pax-logging-service_1.8.5
8 ACTIVE      org.apache.felix.eventadmin_1.4.6
9 ACTIVE      org.apache.felix.scr_2.0.8
10 ACTIVE      org.apache.felix.configadmin_1.8.14
11 ACTIVE      org.apache.felix.fileinstall_3.5.4
...

I am sure I am overlooking something, but at this moment I am lost. I’ll keep 
plugging away, but any suggestions on why this component might be created twice 
(and how to resolve) would be greatly appreciated.


Kind Regards,

Erwin
_______________________________________________
OSGi Developer Mail List
osgi-dev@mail.osgi.org
https://mail.osgi.org/mailman/listinfo/osgi-dev

Reply via email to