>>>>> Steinar Bang <[email protected]>:
> Platform: debian 9.5 "stretch", amd64
> openjdk-8-jdk 8u181-b13-1~deb9u1
> karaf 4.1.5
> (Note: This is a project very much in the start phase so I haven't pushed
> anything to github yet)
> I'm trying to inject a SystemMBean into a DS component. When I try
> this, loading the feature holding the component, fails with an error
> message:
> karaf@root()> feature:repo-add
> mvn:no.priv.bang.neo4j.karaf/neo4j-karaf/LATEST/xml/features
> Adding feature url
> mvn:no.priv.bang.neo4j.karaf/neo4j-karaf/LATEST/xml/features
> karaf@root()> feature:install neo4j-server
> Error executing command: Unable to resolve root: missing requirement [root]
> osgi.identity; osgi.identity=neo4j-server; type=karaf.feature;
> version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]";
> filter:="(&(osgi.identity=neo4j-server)(type=karaf.feature)(version>=1.0.0.SNAPSHOT)(version<=1.0.0.SNAPSHOT))"
> [caused by: Unable to resolve neo4j-server/1.0.0.SNAPSHOT: missing
> requirement [neo4j-server/1.0.0.SNAPSHOT] osgi.identity;
> osgi.identity=no.priv.bang.neo4j.karaf; type=osgi.bundle;
> version="[1.0.0.SNAPSHOT,1.0.0.SNAPSHOT]"; resolution:=mandatory [caused by:
> Unable to resolve no.priv.bang.neo4j.karaf/1.0.0.SNAPSHOT: missing
> requirement [no.priv.bang.neo4j.karaf/1.0.0.SNAPSHOT] osgi.service;
> filter:="(objectClass=org.apache.karaf.system.management.SystemMBean)";
> effective:=active]]
> karaf@root()>
If I remove the
@Reference
public void setLogservice(LogService logservice) {
this.logservice = logservice;
}
then my feature loads:
karaf@root()> feature:repo-add
mvn:no.priv.bang.neo4j.karaf/neo4j-karaf/LATEST/xml/features
Adding feature url mvn:no.priv.bang.neo4j.karaf/neo4j-karaf/LATEST/xml/features
karaf@root()> feature:install neo4j-server
karaf@root()>
So I guess this means that the above message is because the service
dependency isn't satisfied...?
But why isn't the ServiceMBean service dependency satisfied from this?
karaf@root()> bundle:capabilities org.apache.karaf.system.core
org.apache.karaf.system.core [46] provides:
-------------------------------------------
osgi.wiring.bundle; org.apache.karaf.system.core 4.1.5 [UNUSED]
osgi.wiring.host; org.apache.karaf.system.core 4.1.5 [UNUSED]
osgi.identity; org.apache.karaf.system.core 4.1.5 [UNUSED]
osgi.wiring.package; org.apache.karaf.system 4.1.5 [UNUSED]
osgi.wiring.package; org.apache.karaf.system.management 4.1.5 [UNUSED]
service; [org.apache.karaf.system.SystemService] with properties:
service.bundleid = 46
service.id = 103
service.scope = singleton
Used by:
org.apache.karaf.system.core [46]
service; [org.apache.karaf.system.management.SystemMBean,
javax.management.DynamicMBean, javax.management.MBeanRegistration] with
properties:
jmx.objectname = org.apache.karaf:type=system,name=root
service.bundleid = 46
service.id = 104
service.scope = singleton
Used by:
org.apache.aries.jmx.whiteboard [18]
karaf@root()>
Maybe I would be better off trying to inject the SystemService? (if that
does what I need to do? Yep, it appears to have the same methods, more
or less... [1])
References
[1]
<https://github.com/apache/karaf/blob/master/system/src/main/java/org/apache/karaf/system/SystemService.java>