Hi,
I am not able to find solution for above error. please find my code snippet below
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.ReferenceCardinality;
import org.osgi.service.component.annotations.ReferencePolicy;
@component(/* service = ConfigUtil.class, */ immediate = true,
reference = {
@reference(name = "configutil", bind = "bindAssetDetailsSelector"
unbind = "unbindAssetDetailsSelector", service = DataPowerUrlUtil.class,
policy = ReferencePolicy.DYNAMIC, cardinality = ReferenceCardinality.MULTIPLE
) }
)
using maven-bundle-plugin version 4.2.1, <artifactId>org.osgi.service.component.annotations</artifactId> verion 1.4.0,
R7 annotation
Thanks,
Sai
Solved! Go to Solution.
Views
Replies
Total Likes
Hi Sai, Just check the below and try.
@Component(service = ConfigUtil.class, configurationPolicy = ConfigurationPolicy.REQUIRE, immediate = true)
@Designate(ocd = ConfigUtilImpl.Config.class)
Thanks.
Hi Sai, Just check the below and try.
@Component(service = ConfigUtil.class, configurationPolicy = ConfigurationPolicy.REQUIRE, immediate = true)
@Designate(ocd = ConfigUtilImpl.Config.class)
Thanks.
Hi @sai1007 ,
Which Maven Archetype you are using in your project? I am able to include @Reference annotation inside @Component annotation without any issue. I am using 6+ version of OSGI dependencies. Try using below if it resolves your issue-
(Also, I see there is one comma missing after 'bind = "bindAssetDetailsSelector" ' and small 'r' for Reference annotation but I believe those are just typos.)
<!-- OSGi Dependencies -->
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.core</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.cmpn</artifactId>
<version>6.0.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>osgi.annotation</artifactId>
<version>6.0.1</version>
<scope>provided</scope>
</dependency>
I think you have to use @OsgiService annotation instead of @reference
Views
Likes
Replies
Views
Likes
Replies