Thanks Bernd,

The service descriptor is created off of the @Component annotation and seems 
ok. Nothing out of the ordinary in the manifest either as far as I can see. 

<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.3.0"; 
name="my.service" configuration-policy="require" activate="activate" 
deactivate="deactivate" modified="modified">
  <implementation class="my.service.impl.MyHazelcastOSGiServiceImpl"/>
  <service>
    <provide interface="my.service.MyHazelcastOSGiService"/>
  </service>
  <reference name="hazelcastService" 
interface="com.hazelcast.osgi.HazelcastOSGiService" field="hazelcastService"/>
</scr:component>

Manifest-Version: 1.0
Bnd-LastModified: 1516299166975
Build-Jdk: 1.8.0_92
Built-By: erwin
Bundle-Category:
Bundle-ManifestVersion: 2
Bundle-Name: HazelCast Replication Service
Bundle-SymbolicName: my.service
Bundle-Vendor: Seecago, Inc.
Bundle-Version: 4.3.0.SNAPSHOT_20180118-1312
Created-By: Apache Maven Bundle Plugin
Export-Package: my.service;version="4.3.0"
Import-Package: my.service;version="[4.3,5
 )",com.hazelcast.config;version="[3.8,4)",com.hazelcast.osgi;version="[
 3.8,4)",org.apache.commons.logging,org.osgi.framework;version="[1.8,2)"
 ,org.osgi.service.cm;version="[1.5,2)"
Provide-Capability: osgi.service;objectClass:List<String>="my.service.My
HazelcastOSGiService"
Require-Capability: osgi.extender;filter:="(&(osgi.extender=osgi.compone
 nt)(version>=1.3.0)(!(version>=2.0.0)))",osgi.service;filter:="(objectC
 lass=com.hazelcast.osgi.HazelcastOSGiService)";effective:=active,osgi.e
 e;filter:="(&(osgi.ee=JavaSE)(version=1.8))"
Service-Component: OSGI-INF/my.component.xml
Tool: Bnd-3.0.0.201509101326


Regards,

Erwin

> On Jan 18, 2018, at 18:52, Bernd Eckenfels <e...@zusammenkunft.net> wrote:
> 
> 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