私の目標は、バンドルから OSGi への依存関係を取り除くことです。felix (v 4.2.1) を impl として使用し、組み込み可能に実行します。org.apache.felix.scr
Service Component Runtime をサポートするために (v. 1.6.2) バンドルをインストールします。しかし、私が走るとき
ServiceReference ref = bundleContext().getServiceReference(ScrService.class.getName());
ScrService s = (ScrService) bundleContext().getService(ref);
私は得るClassCastException: org.apache.felix.scr.impl.ComponentRegistry cannot be cast to org.apache.felix.scr.ScrService
。
わかった。システムパッケージを変更します。
config.put(Constants.FRAMEWORK_SYSTEMPACKAGES, "org.apache.felix.scr");
今私は得る
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; (&(osgi.wiring.package=org.osgi.framework)(version>=1.4.0)(!(version>=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
どうすれば解決できますか?