java - OSGi bundles won't start - Unable to resolve sun.reflect.generics.reflectiveObjects -


after seemingly irrelevant changes in code of aem project, bundle fails resolve. upon inspecting logs, can see following errors appearing.

22.04.2015 11:00:18.650 *error* [qtp1266495948-35] org.apache.felix.http.jetty %bundles.plugintitle: cannot start (org.osgi.framework.bundleexception: unresolved constraint in bundle my-bundle ... [caused by: unable resolve 401.121: missing requirement [401.121] osgi.wiring.package; (osgi.wiring.package=sun.reflect.generics.reflectiveobjects)]] 

the project compiles fine locally , problem occurs after bundle's installation when container attempts resolve it.

i haven't added explicit dependencies in of changes. project object models same before. name implies core java package i'd expect exposed system bundle.

i'm running jdk 7, supported aem not expect matter of jvm compatibility. @ least when aem internals concerned.

the package sun.reflect.generics.reflectiveobjects part of jdk it's not part of java api, explained in oracle's documentation java 7 compatibility

the sun.* packages are not part of supported, public interface. java program directly calls sun.* packages not guaranteed work on java-compatible platforms. in fact, such program not guaranteed work in future versions on same platform.

this explains why package not exported system bundle in apache felix, underlying aem. reasonable decision indeed. code compiled locally because package in classpath failed @ runtime, fine , expected.

my code should not using package in first place. there 2 possible ways of introducing dependency on these packages.

  1. use library uses these classes reason , introduce transitive dependency. isn't happened.

  2. import 1 of these classes - silly thing do. if uses class, should know is.

in case, explicitly imported class package without noticing it.

it turns out sun.reflect.generics.reflectiveobjects package contains notimplementedexception class, name of coincides often-used notimplementedexception apache.commons.lang3.

i accidentally imported when auto-completed in ide , failed notice long time. took me git bisect isolate change.

after happened, excluded sun.* packages autocomplete.


Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -