Hey guys,
I'm trying to access the ServerInfo service from my bundle. In my bundle I
included the following in my pom.xml
<dependency>
<groupId>org.apache.karaf</groupId>
<artifactId>org.apache.karaf.main</artifactId>
<version>${karaf.version}</version>
<scope>provided</scope>
</dependency>
I marked it provided since it is already included by Karaf. I know this
because I can list the services in Bundle 0 and see the ServerInfo service.
I can also debug my bundle with the following and see the service returned.
ServiceReference<?> ref = bundleContext.getServiceReference(
"org.apache.karaf.info.ServerInfo" );
bundleContext.getService( ref );
However if I try try to import the ServerInfo in my class like this:
ServiceReference<ServerInfo> ref =
bundleContext.getServiceReference(ServerInfo.class);
ServerInfo serverInfo = (ServerInfo) bundleContext.getService(ref);
Then I get the following bundle wiring error:
osgi.wiring.package;
filter:="(&(osgi.wiring.package=org.apache.karaf.info)(version>=4.0.0)(!(version>=5.0.0)))"]]
Any ideas how I can fix this?
Thanks,
Chris
--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-Dev-f930721.html