karaf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jean-Baptiste Onofré ...@nanthrax.net>
Subject Re: ServerInfo usage question
Date Wed, 10 Jan 2018 11:10:22 GMT
Hi Chris,

in your bundle, do you use:

org.apache.karaf.info;version="[3,5)"

in the Import-Package ?

I think your import doesn't match exactly the version.

Regards
JB

On 01/10/2018 04:39 AM, Chris Caspanello wrote:
> 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
> 

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Mime
View raw message