title: Using Service Component Runtime
body: <p>I goal is to remove dependencies on OSGi from my bundles. I use felix (v 4.2.1) as impl and run it embeddable. I install <code>org.apache.felix.scr</code> (v. 1.6.2) bundle to have Service Component Runtime support. But when I run </p>
  
  <pre><code> ServiceReference ref = bundleContext().getServiceReference(ScrService.class.getName());
   ScrService s = (ScrService) bundleContext().getService(ref);
  </code></pre>
  
  <p>I get <code>ClassCastException: org.apache.felix.scr.impl.ComponentRegistry cannot be cast to org.apache.felix.scr.ScrService</code>.</p>
  
  <p>Okay. I will modify System Packages.</p>
  
  <pre><code>config.put(Constants.FRAMEWORK_SYSTEMPACKAGES, "org.apache.felix.scr");
  </code></pre>
  
  <p>Now I get</p>
  
  <pre><code>Caused by: org.osgi.framework.BundleException: Unresolved constraint in bundle org.apache.felix.scr [1]: Unable to resolve 1.0: missing requirement [1.0] osgi.wiring.package; (&amp;(osgi.wiring.package=org.osgi.framework)(version&gt;=1.4.0)(!(version&gt;=2.0.0)))
          at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:3974)
          at org.apache.felix.framework.Felix.startBundle(Felix.java:2037)
          at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)
          at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:942)
          at com.copyright.rup.communications.felix.Felix.addBundle(Felix.java:86)
          ... 28 more
  </code></pre>
  
  <p>How can I solve it?</p>