karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Guillaume Nodet <gno...@apache.org>
Subject Re: ServerInfo usage question
Date Wed, 10 Jan 2018 12:07:51 GMT
That's a bug, the package should be made available.
You add it manually in etc/config.properties by modifying the
org.osgi.framework.system.packages  property and adding:
    org.apache.karaf.info;version="4.2.0.SNAPSHOT"
Could you raise a JIRA about that ?

2018-01-10 4:39 GMT+01:00 Chris Caspanello <ccaspanello@gmail.com>:

> 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
>



-- 
------------------------
Guillaume Nodet

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message