Non è stato possibile avviare il bundle a causa della duplicazione dell'esportazione | AEM - OSGi, Apache Felix

Ambiente

AEM 6.x

Problema

Alcuni bundle OSGi non si avviano sull'istanza AEM. Un errore, simile a quello che segue, si verifica quando gli utenti cercano di avviare i bundle che non riescono:

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)

Causa

Ci sono esportazioni OSGi duplicate dello stesso pacchetto java con versioni sovrapposte, come indicato nell'errore.

Risoluzione

Leggi attentamente il messaggio di log che ti dice esattamente quali bundle di OSGi esportano lo stesso pacchetto java, come mostrato sotto:

"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"

Quindi, ci sono due pacchetti che esportano javax.activation:

  1. org.apache.felix.framework- Bundle framework di Apache Felix
  2. org.apache.apache.sling.javax.activation- Fornisce bundle Sling

Ulteriori ricerche dimostrano che il bundle Sling appartiene ad AEM e che l'esportazione del framework export di javax.activation non è valida. Le esportazioni del bundle framework possono avere origine da quanto segue:

  1. Parametro JVM per bootdelegation -Dorg.osgi.framework.bootdelegation
  2. Un bundle framework di estensione
  3. AEM's conf/sling.properties org.osgi.framework.system.capabilities.extra and org.osgi.framework.bootdelegation configurations

Se una qualsiasi di queste configurazioni viene modificata per aggiungere un'esportazione per javax.activation, si verifica il problema.

Logo Adobe

Accedi al tuo account