OK, it’s official, I’m an idiot. You’d think I could have figured that out on 
my own.  I have a script that configures Karaf when I upgrade. Since I’ve been 
using Blueprint prior to this I’ve never had to install it before so I missed 
that.  Thanks so much.

BTW, just want to tell everyone involved in both Karaf and BndTools what a 
great job both teams have done. Truly excellent work all the way around.

From: Achim Nierbeck [mailto:[email protected]]
Sent: Friday, May 13, 2016 10:57 AM
To: [email protected]
Subject: Re: Can't resolve org.osgi.service.component 1.2 ?

Hi,

did you also install the scr feature, and did you make sure it's actually the 
required version ;)

regards, Achim


2016-05-13 17:51 GMT+02:00 Leschke, Scott 
<[email protected]<mailto:[email protected]>>:
Hi all,

I’ve been messing around with OSGi and Karaf for a bit over 2 years now. 
Technically I’m no longer a developer, although if you want to get stuff done, 
sometimes you just have to do it yourself. I’ve built a BAM (Business Activity 
Monitoring) platform using OSGi (I wasn’t aware of Decanter when I originally 
did this but it sounds very similar in many ways. Looking more closely at that 
is a future).

To date, I’ve done everything using Blueprint which has worked quite well but I 
thought it might be time to take a look at DS to see where that might fit in. 
To get a feel, I had BndTools create a component bundle and tweaked things a 
bit so that it should run in Karaf 4.0.5 as BndTools appears to be anticipating 
OSGi R6 support. I changed the build to reference osgi.cmpn; version=5.0 for 
example.

When I deploy the bundle, the resolver complains about not being able to 
satisfy the package requirement: org.osgi.service.component - version 
[1.2-2.0). I’ve looked at the manifest and verified that the package is 
actually imported so I’m at a loss.  The component code and actual bundle 
manifest are shown below, for completeness.  Any thoughts on what might be 
going on would be appreciated.

Regards, Scott


Manifest-Version: 1.0
Bnd-LastModified: 1463152495066
Bundle-ManifestVersion: 2
Bundle-Name: zCompTest
Bundle-SymbolicName: zCompTest
Bundle-Version: 1.0.0.201605131514
Created-By: 1.8.0_71 (Oracle Corporation)
Export-Package: com.medline.zcomptest;version="1.0.0";uses:="org.osgi.
service.component"
Import-Package: org.osgi.service.component;version="[1.2,2)"
Require-Capability: 
osgi.ee<http://osgi.ee>;filter:="(&(osgi.ee<http://osgi.ee>=JavaSE)(version=1.8))"
Service-Component: OSGI-INF/com.medline.zcomptest.Example.xml
Tool: Bnd-3.2.0.201605070046-SNAPSHOT


import org.osgi.service.component.ComponentContext;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;

@Component(
immediate = true
)
public class Example {

       @Activate
       protected void activate(ComponentContext c)
       {
              System.out.println("++ ACTIVATE");
       }

       @Deactivate
       protected void deactivate(ComponentContext c)
       {
              System.out.println("-- DEACTIVATE");
       }
}



--

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer & 
Project Lead
blog <http://notizblog.nierbeck.de/>
Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>

Software Architect / Project Manager / Scrum Master

Reply via email to