Bundle failed to start due to duplicate export | AEM - OSGi, Apache Felix

Environment

AEM 6.x

Issue

Some OSGi bundles fail to start on AEM instance. An error, similar to the one below, shows up when users try to start the failing bundles:

30.12.2016 13:11:44.069 *ERROR* [qtp1529861461-2584] org.apache.felix.http.jetty %bundles.pluginTitle: Cannot start (org.osgi.framework.BundleException: Uses constraint violation. Unable to resolve resource com.adobe.cq.dam.cq-scene7-imaging [com.adobe.cq.dam.cq-scene7-imaging [436](R 436.3)] because it is exposed to package 'javax.activation' from resources org.apache.felix.framework [org.apache.felix.framework [0](R 0)] and org.apache.sling.javax.activation [org.apache.sling.javax.activation [11](R 11.0)] via two dependency chains.

Chain 1:
  com.adobe.cq.dam.cq-scene7-imaging [com.adobe.cq.dam.cq-scene7-imaging [436](R 436.3)]
    import: (osgi.wiring.package=javax.activation)
     |
    export: osgi.wiring.package: javax.activation
  org.apache.felix.framework [org.apache.felix.framework [0](R 0)]

Chain 2:
  com.adobe.cq.dam.cq-scene7-imaging [com.adobe.cq.dam.cq-scene7-imaging [436](R 436.3)]
    import: (osgi.wiring.package=javax.mail)
     |
    export: osgi.wiring.package=javax.mail; uses:=javax.activation
  javax.mail [javax.mail [209](R 209.0)]
    import: (osgi.wiring.package=javax.activation)
     |
    export: osgi.wiring.package: javax.activation
  org.apache.sling.javax.activation [org.apache.sling.javax.activation [11](R 11.0)] Unresolved requirements: [[com.adobe.cq.dam.cq-scene7-imaging [436](R 436.3)] osgi.wiring.package; (osgi.wiring.package=javax.mail)])
org.osgi.framework.BundleException: Uses constraint violation. Unable to resolve resource com.adobe.cq.dam.cq-scene7-imaging [com.adobe.cq.dam.cq-scene7-imaging [436](R 436.3)] because it is exposed to package 'javax.activation' from resources org.apache.felix.framework [org.apache.felix.framework [0](R 0)] and org.apache.sling.javax.activation [org.apache.sling.javax.activation [11](R 11.0)] via two dependency chains.

Chain 1:
  com.adobe.cq.dam.cq-scene7-imaging [com.adobe.cq.dam.cq-scene7-imaging [436](R 436.3)]
    import: (osgi.wiring.package=javax.activation)
     |
    export: osgi.wiring.package: javax.activation
  org.apache.felix.framework [org.apache.felix.framework [0](R 0)]

Chain 2:
  com.adobe.cq.dam.cq-scene7-imaging [com.adobe.cq.dam.cq-scene7-imaging [436](R 436.3)]
    import: (osgi.wiring.package=javax.mail)
     |
    export: osgi.wiring.package=javax.mail; uses:=javax.activation
  javax.mail [javax.mail [209](R 209.0)]
    import: (osgi.wiring.package=javax.activation)
     |
    export: osgi.wiring.package: javax.activation
  org.apache.sling.javax.activation [org.apache.sling.javax.activation [11](R 11.0)] Unresolved requirements: [[com.adobe.cq.dam.cq-scene7-imaging [436](R 436.3)] osgi.wiring.package; (osgi.wiring.package=javax.mail)]
        at org.apache.felix.framework.Felix.resolveBundleRevision(Felix.java:4111)
        at org.apache.felix.framework.Felix.startBundle(Felix.java:2117)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:998)
        at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:984)
        at org.apache.felix.webconsole.internal.core.BundlesServlet.doPost(BundlesServlet.java:365)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:644)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
        at org.apache.felix.webconsole.internal.servlet.OsgiManager.service(OsgiManager.java:567)
        at org.apache.felix.webconsole.internal.servlet.OsgiManager$3.run(OsgiManager.java:465)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.apache.felix.webconsole.internal.servlet.OsgiManager.service(OsgiManager.java:461)
        at org.apache.felix.http.base.internal.handler.ServletHandler.handle(ServletHandler.java:85)
        at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:79)
        at com.adobe.granite.license.impl.LicenseCheckFilter.doFilter(LicenseCheckFilter.java:308)
        at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
        at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
        at org.apache.felix.http.sslfilter.internal.SslFilter.doFilter(SslFilter.java:89)
        at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
        at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
        at org.apache.sling.security.impl.ReferrerFilter.doFilter(ReferrerFilter.java:290)
        at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
        at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
        at org.apache.sling.i18n.impl.I18NFilter.doFilter(I18NFilter.java:129)
        at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
        at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
        at org.apache.sling.featureflags.impl.FeatureManager.doFilter(FeatureManager.java:116)
        at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
        at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
        at org.apache.sling.engine.impl.log.RequestLoggerFilter.doFilter(RequestLoggerFilter.java:75)
        at org.apache.felix.http.base.internal.handler.FilterHandler.handle(FilterHandler.java:135)
        at org.apache.felix.http.base.internal.dispatch.InvocationChain.doFilter(InvocationChain.java:74)
        at org.apache.felix.http.base.internal.dispatch.Dispatcher.dispatch(Dispatcher.java:124)
        at org.apache.felix.http.base.internal.DispatcherServlet.service(DispatcherServlet.java:61)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:725)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:587)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)

Cause

There are duplicate OSGi exports of the same java package with overlapping versions, as mentioned in the error.

Resolution

Read the log message carefully that tells you exactly which OSGi bundles are exporting the same java package, as shown below: 

"it is exposed to package 'javax.activation' from resources org.apache.felix.framework [org.apache.felix.framework [0](R 0)] and org.apache.sling.javax.activation [org.apache.sling.javax.activation [11](R 11.0)] via two dependency chains"

So, there are two bundles exporting javax.activation: 

  1. org.apache.felix.framework- Apache Felix Framework bundle
  2. org.apache.sling.javax.activation- Sling bundle providing 

Further research shows that the sling bundle belongs to AEM and the framework export of javax.activation is invalid. Framework bundle exports can originate from the following: 

  1. JVM parameter for bootdelegation -Dorg.osgi.framework.bootdelegation
  2. A framework extension bundle
  3. AEM's conf/sling.properties org.osgi.framework.system.capabilities.extra and org.osgi.framework.bootdelegation configurations

If any of those configurations are modified to add an export for javax.activation, then it would cause the issue.

 Adobe

Получете помощ по-бързо и по-лесно

Нов потребител?

Adobe MAX 2024

Adobe MAX

The Creativity Conference

14 – 16 октомври, Маями Бийч и онлайн

Adobe MAX 2024

Adobe MAX

The Creativity Conference

14 – 16 октомври, Маями Бийч и онлайн