Search code examples
javaosgiapache-felixweld

Weld-osgi-bundle-2.2.10.Final unable to resolve sun.misc


I am trying to install weld-osgi-bundle to apache felix and I get this exception -

org.osgi.framework.BundleException: Unresolved constraint in bundle org.jboss.weld.osgi-bundle [15]: Unable to resolve 15.0: missing requirement [15.0] osgi.wiring.package; (osgi.wiring.package=sun.misc)
    at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4097)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:2114)
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:977)
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:964)

The only way I know is to put this in Constants.FRAMEWORK_SYSTEMPACKAGES of Felix config as JDK provides this package. Something like this:

String SYSTEM_PACKAGES = "sun.misc";
configMap.put(Constants.FRAMEWORK_SYSTEMPACKAGES, SYSTEM_PACKAGES);

However, if I follow this way I will have to export all used javax etc packages. How to solve such problem? I tried to find osgi bundle with sun.misc but couldn't.


Solution

  • Replace FRAMEWORK_SYSTEMPACKAGES with FRAMEWORK_SYSTEMPACKAGES_EXTRA. This appends to the system package exports, rather than overwriting them.