Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

AEM: BundleException

Avatar

Level 2

Hi

I am upgrading from AEM 6.2 to 6.4.

As part of 6.2 work, I have been using javax.annotation (version 1.3) as a separate bundle and it has been working fine.

But when I install the same to 6.4 I get the following error on almost all other framework bundles

So, for example for bundle:

I am now getting:

and not:

I do understand that now there are two bundles (1.3 and 0.0.0.1_008_JavaSE) available for javax.annotaion and hence the issue.

What I don't understand is why this was working with 6.2 and not with 6.4?

Also, please advice how to fix this? I need the javax.annotation (1.3) version as I am using cxf libraries.

19 Replies

Avatar

Employee Advisor

Looks like you don't need the javax.annotation-api bundle anymore, but instead javax.activation is directly included into the exports of the OSGI frameworks.

Jörg

Avatar

Level 2

Thanks for the reply.

I do need the 1.3 version of this bundle.

Default version is 0.0.0.1_008_JavaSE and has always been included in both 6.2 and 6.4

Avatar

Level 2

No, I've just updated my poms to include the new dependencies for 6.4

Avatar

Level 10

Try rebuilding your bundle using Maven 13 Archetype.

Creating an Adobe Experience Manager 6.4 Project using Adobe Maven Archetype 13

The benefit of this is it builds new POMs and new project. I have not seen these reported errors that you are referring to when a new Maven 13 project is built. Trying to update an old project with new POMs can lead to errors.

Avatar

Employee Advisor

The exports of the javax.annotation package has not changed from AEM 6.2 and AEM 6.4, they are both exported from the system bundle and taken from the JRE.

That makes me wonder why you have the package "javax.annotation-api" installed at all, even in AEM 6.2 it shouldn't be necessary to have it deployed.

Jörg

Avatar

Level 2

On AEM 6.4 this is what I get: http://localhost:9503/system/console/depfinder

Package                         Version                                    Exported by

javax.annotation             0.0.0.1_008_JavaSE               org.apache.felix.framework (0)

But the CXF bundles need 1.3 version of javax.annotation:

org.apache.cxf.cxf-rt-rs-client
org.apache.cxf.cxf-rt-frontend-jaxrs
org.apache.cxf.cxf-rt-rs-security-jose-jaxrs
org.apache.cxf.cxf-rt-rs-security-oauth2

Avatar

Employee Advisor

Ok, understood.

The felix framework exports the packages from the classpath; in that case javax.annotation. And all packages are exported with this "default" version no matter what version of the standard the rt.jar is actually implementing. That's unfortunate in your case.

You encountered this as a problem when switching from AEM 6.2 to AEM 6.4; between these releases the OSGI framework has changed as well, maybe the order of resolution has changed in case duplicates are present, not sure. I would recommend to post this question on the user@felix.apache.org mailinglist. There you can reach OSGI specialists which know the details much better than we do.

Jörg

Avatar

Level 4

You need to rebuild your bundle using Archetype 13. It will add necessary decencies which are not being located using your old bundle. Try that it should work.

Avatar

Level 2

Thanks for all the replies.

However, this problem is different. My project uses a number of external bundles and I've created a new package to embed all these 3rd-part bundles. There are 10 in total.

In this list of 10 we also have these two as well:

javax.annotation-3.1.jar

cxf-rt-frontend-jaxrs-3.1.10.jar

It all works well till I deploy the cxf-rt-frontend-jaxrs bundle. It seem to deploy fine but when I restart AEM most the Adobe bundles start throwing this error, e.g.:

05.09.2018 11:13:40.243 *ERROR* [FelixDispatchQueue] com.adobe.aemds.formsmanager.adobe-aemds-formsanddocuments-core FrameworkEvent ERROR (org.osgi.framework.BundleException: Uses constraint violation. Unable to resolve resource com.adobe.aemds.formsmanager.adobe-aemds-formsanddocuments-core [com.adobe.aemds.formsmanager.adobe-aemds-formsanddocuments-core [169](R 169.0)] because it is exposed to package 'javax.annotation' from resources org.apache.felix.framework [org.apache.felix.framework [0](R 0)] and javax.annotation-api [javax.annotation-api [558](R 558.0)] via two dependency chains.

Chain 1:

  com.adobe.aemds.formsmanager.adobe-aemds-formsanddocuments-core [com.adobe.aemds.formsmanager.adobe-aemds-formsanddocuments-core [169](R 169.0)]

    import: (osgi.wiring.package=javax.annotation)

     |

    export: osgi.wiring.package: javax.annotation

  org.apache.felix.framework [org.apache.felix.framework [0](R 0)]

Chain 2:

  com.adobe.aemds.formsmanager.adobe-aemds-formsanddocuments-core [com.adobe.aemds.formsmanager.adobe-aemds-formsanddocuments-core [169](R 169.0)]

    import: (&(osgi.wiring.package=com.adobe.aemds.guide.utils)(version>=3.10.0)(!(version>=4.0.0)))

     |

    export: osgi.wiring.package=com.adobe.aemds.guide.utils; uses:=org.apache.jackrabbit.api.security.user

  com.adobe.aemds.guide.aemds-guide-core [com.adobe.aemds.guide.aemds-guide-core [175](R 175.0)]

    import: (&(osgi.wiring.package=org.apache.jackrabbit.api.security.user)(version>=2.4.0)(!(version>=3.0.0)))

     |

    export: osgi.wiring.package=org.apache.jackrabbit.api.security.user; uses:=javax.annotation

  org.apache.jackrabbit.jackrabbit-api [org.apache.jackrabbit.jackrabbit-api [118](R 118.0)]

    import: (osgi.wiring.package=javax.annotation)

     |

    export: osgi.wiring.package: javax.annotation

  javax.annotation-api [javax.annotation-api [558](R 558.0)] Unresolved requirements: [[com.adobe.aemds.formsmanager.adobe-aemds-formsanddocuments-core [169](R 169.0)] osgi.wiring.package; (&(osgi.wiring.package=com.adobe.aemds.guide.utils)(version>=3.10.0)(!(version>=4.0.0)))])

org.osgi.framework.BundleException: Uses constraint violation. Unable to resolve resource com.adobe.aemds.formsmanager.adobe-aemds-formsanddocuments-core [com.adobe.aemds.formsmanager.adobe-aemds-formsanddocuments-core [169](R 169.0)] because it is exposed to package 'javax.annotation' from resources org.apache.felix.framework [org.apache.felix.framework [0](R 0)] and javax.annotation-api [javax.annotation-api [558](R 558.0)] via two dependency chains.

cxf-rt-frontend-jaxrs-3.1.10.jar

After restart this bundle is active but most of the other (adobe ones) are not.

I've also restart AEM with the other 9 bundles and that is ok.

Is this bundle exporting anything which it should not? Do I need to rewrap this?

Imported Packages

javax.activation,version=1.1.1 from org.apache.sling.javax.activation (15)

javax.annotation,version=1.3.0 from javax.annotation-api (558)

javax.security.auth,version=0.0.0.1_008_JavaSE from org.apache.felix.framework (0)

javax.security.auth.callback,version=0.0.0.1_008_JavaSE from org.apache.felix.framework (0)

javax.security.auth.login,version=0.0.0.1_008_JavaSE from org.apache.felix.framework (0)

javax.servlet,version=2.6.0 from org.apache.felix.http.servlet-api (43)

javax.servlet,version=3.1.0 from org.apache.felix.http.servlet-api (43)

javax.servlet,version=3.0.0 from org.apache.felix.http.servlet-api (43)

javax.servlet.descriptor,version=2.6.0 from org.apache.felix.http.servlet-api (43)

javax.servlet.descriptor,version=3.1.0 from org.apache.felix.http.servlet-api (43)

javax.servlet.descriptor,version=3.0.0 from org.apache.felix.http.servlet-api (43)

javax.servlet.http,version=2.6.0 from org.apache.felix.http.servlet-api (43)

javax.servlet.http,version=3.1.0 from org.apache.felix.http.servlet-api (43)

javax.servlet.http,version=3.0.0 from org.apache.felix.http.servlet-api (43)

javax.ws.rs,version=2.0.1 from javax.ws.rs-api (559)

javax.ws.rs.client,version=2.0.1 from javax.ws.rs-api (559)

javax.ws.rs.container,version=2.0.1 from javax.ws.rs-api (559)

javax.ws.rs.core,version=2.0.1 from javax.ws.rs-api (559)

javax.ws.rs.ext,version=2.0.1 from javax.ws.rs-api (559)

javax.xml,version=0.0.0.fragment_xml from org.apache.felix.framework (0)

javax.xml.bind,version=2.1.0 from org.apache.felix.framework (0)

javax.xml.bind.annotation,version=2.1.0 from org.apache.felix.framework (0)

javax.xml.bind.annotation.adapters,version=2.1.0 from org.apache.felix.framework (0)

javax.xml.bind.attachment,version=2.1.0 from org.apache.felix.framework (0)

javax.xml.namespace,version=0.0.0.fragment_xml from org.apache.felix.framework (0)

javax.xml.stream,version=1.0.0 from org.apache.felix.framework (0)

javax.xml.stream.events,version=1.0.0 from org.apache.felix.framework (0)

javax.xml.transform,version=0.0.0.fragment_xml from org.apache.felix.framework (0)

javax.xml.transform.dom,version=0.0.0.fragment_xml from org.apache.felix.framework (0)

javax.xml.transform.sax,version=0.0.0.fragment_xml from org.apache.felix.framework (0)

javax.xml.transform.stream,version=0.0.0.fragment_xml from org.apache.felix.framework (0)

javax.xml.validation,version=0.0.0.fragment_xml from org.apache.felix.framework (0)

javax.xml.xpath,version=0.0.0.fragment_xml from org.apache.felix.framework (0)

org.apache.cxf,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.annotations,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.attachment,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.binding,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.bus.blueprint,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.bus.spring,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.catalog,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.common.classloader,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.common.i18n,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.common.injection,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.common.jaxb,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.common.logging,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.common.security,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.common.util,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.common.xmlschema,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.configuration,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.configuration.blueprint,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.configuration.security,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.configuration.spring,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.continuations,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.databinding,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.endpoint,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.feature,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.helpers,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.interceptor,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.interceptor.security,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.io,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.logging,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.message,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.phase,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.resource,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.security,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.service,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.service.factory,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.service.invoker,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.service.model,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.staxutils,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.staxutils.transform,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.transport,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.transport.http,version=3.1.10 from org.apache.cxf.cxf-rt-transports-http (553)

org.apache.cxf.transport.http.auth,version=3.1.10 from org.apache.cxf.cxf-rt-transports-http (553)

org.apache.cxf.transport.servlet,version=3.1.10 from org.apache.cxf.cxf-rt-transports-http (553)

org.apache.cxf.validation,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.cxf.ws.addressing,version=3.1.10 from org.apache.cxf.cxf-core (546)

org.apache.ws.commons.schema.constants,version=2.2.1 from org.apache.ws.xmlschema.core (562)

org.ietf.jgss,version=0.0.0.1_008_JavaSE from org.apache.felix.framework (0)

org.osgi.framework,version=1.8.0 from org.apache.felix.framework (0)

org.osgi.service.blueprint.container,version=1.0.2 from org.osgi.service.blueprint (561)

org.osgi.service.blueprint.reflect,version=1.0.1 from org.osgi.service.blueprint (561)

org.w3c.dom,version=0.0.0.fragment_xml from org.apache.felix.framework (0)

org.w3c.dom.ls,version=0.0.0.fragment_xml from org.apache.felix.framework (0)

org.xml.sax,version=0.0.0.fragment_xml from org.apache.felix.framework (0)

org.xml.sax.helpers,version=0.0.0.fragment_xml from org.apache.felix.framework (0)


Importing Bundles

org.apache.cxf.cxf-rt-rs-client (547)

org.apache.cxf.cxf-rt-rs-security-jose-jaxrs (550)

org.apache.cxf.cxf-rt-rs-security-oauth2 (551)

org.apache.tika.parsers (87)


Manifest Headers

Bnd-LastModified: 1485541945836

Build-Jdk: 1.8.0_112

Built-By: dkulp

Bundle-ActivationPolicy: lazy

Bundle-Activator: org.apache.cxf.jaxrs.blueprint.Activator

Bundle-Description: Apache CXF Runtime JAX-RS Frontend

Bundle-DocURL: http://cxf.apache.org

Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt

Bundle-ManifestVersion: 2

Bundle-Name: Apache CXF Runtime JAX-RS Frontend

Bundle-SymbolicName: org.apache.cxf.cxf-rt-frontend-jaxrs

Bundle-Vendor: The Apache Software Foundation

Bundle-Version: 3.1.10

Created-By: Apache Maven Bundle Plugin

Export-Package: org.apache.cxf.jaxrs; version="3.1.10", org.apache.cxf.jaxrs.blueprint; version="3.1.10", org.apache.cxf.jaxrs.ext; version="3.1.10", org.apache.cxf.jaxrs.ext.multipart; version="3.1.10", org.apache.cxf.jaxrs.ext.xml; version="3.1.10", org.apache.cxf.jaxrs.impl; version="3.1.10", org.apache.cxf.jaxrs.impl.tl; version="3.1.10", org.apache.cxf.jaxrs.interceptor; version="3.1.10", org.apache.cxf.jaxrs.lifecycle; version="3.1.10", org.apache.cxf.jaxrs.model; version="3.1.10", org.apache.cxf.jaxrs.model.doc; version="3.1.10", org.apache.cxf.jaxrs.provider; version="3.1.10", org.apache.cxf.jaxrs.security; version="3.1.10", org.apache.cxf.jaxrs.servlet; version="3.1.10", org.apache.cxf.jaxrs.spring; version="3.1.10", org.apache.cxf.jaxrs.utils; version="3.1.10", org.apache.cxf.jaxrs.utils.multipart; version="3.1.10", org.apache.cxf.jaxrs.utils.schemas; version="3.1.10", org.apache.cxf.jaxrs.validation; version="3.1.10"

Export-Service: org.apache.aries.blueprint.NamespaceHandler; osgi.service.blueprint.namespace="http://cxf.apache.org/blueprint/jaxrs"

Implementation-Vendor: The Apache Software Foundation

Implementation-Vendor-Id: org.apache

Implementation-Version: 3.1.10

Import-Package: javax.servlet; version="[0.0, 4)"; resolution:=optional, javax.servlet.descriptor; version="[0.0, 4)"; resolution:=optional, javax.servlet.http; version="[0.0, 4)"; resolution:=optional, org.apache.aries.blueprint; version="[1.0, 2)"; resolution:=optional, org.apache.aries.blueprint.mutable; version="[1.0, 2)"; resolution:=optional, org.springframework.beans; resolution:=optional; version="[3.1, 5)", org.springframework.beans.factory; resolution:=optional; version="[3.1, 5)", org.springframework.beans.factory.annotation; resolution:=optional; version="[3.1, 5)", org.springframework.beans.factory.config; resolution:=optional; version="[3.1, 5)", org.springframework.beans.factory.support; resolution:=optional; version="[3.1, 5)", org.springframework.beans.factory.xml; resolution:=optional; version="[3.1, 5)", org.springframework.context; resolution:=optional; version="[3.1, 5)", org.springframework.context.annotation; resolution:=optional; version="[3.1, 5)", javax.validation; resolution:=optional; version="[1.0.0, 2)", javax.ws.rs.client; version="[2.0, 3)", javax.ws.rs; version="[1.0, 3)", javax.ws.rs.container; version="[1.0, 3)", javax.ws.rs.core; version="[1.0, 3)", javax.ws.rs.ext; version="[1.0, 3)", javax.activation, javax.annotation; version="[1.2, 2)", javax.security.auth, javax.security.auth.callback, javax.security.auth.login, javax.xml, javax.xml.bind, javax.xml.bind.annotation, javax.xml.bind.annotation.adapters, javax.xml.bind.attachment, javax.xml.namespace, javax.xml.stream, javax.xml.stream.events, javax.xml.transform, javax.xml.transform.dom, javax.xml.transform.sax, javax.xml.transform.stream, javax.xml.validation, javax.xml.xpath, org.apache.cxf; version="[3.1, 4)", org.apache.cxf.annotations; version="[3.1, 4)", org.apache.cxf.attachment; version="[3.1, 4)", org.apache.cxf.binding; version="[3.1, 4)", org.apache.cxf.bus.blueprint; version="[3.1, 4)", org.apache.cxf.bus.spring; version="[3.1, 4)", org.apache.cxf.catalog; version="[3.1, 4)", org.apache.cxf.common.classloader; version="[3.1, 4)", org.apache.cxf.common.i18n; version="[3.1, 4)", org.apache.cxf.common.injection; version="[3.1, 4)", org.apache.cxf.common.jaxb; version="[3.1, 4)", org.apache.cxf.common.logging; version="[3.1, 4)", org.apache.cxf.common.security; version="[3.1, 4)", org.apache.cxf.common.util; version="[3.1, 4)", org.apache.cxf.common.xmlschema; version="[3.1, 4)", org.apache.cxf.configuration; version="[3.1, 4)", org.apache.cxf.configuration.blueprint; version="[3.1, 4)", org.apache.cxf.configuration.security; version="[3.1, 4)", org.apache.cxf.configuration.spring; version="[3.1, 4)", org.apache.cxf.continuations; version="[3.1, 4)", org.apache.cxf.databinding; version="[3.1, 4)", org.apache.cxf.endpoint; version="[3.1, 4)", org.apache.cxf.feature; version="[3.1, 4)", org.apache.cxf.helpers; version="[3.1, 4)", org.apache.cxf.interceptor; version="[3.1, 4)", org.apache.cxf.interceptor.security; version="[3.1, 4)", org.apache.cxf.io; version="[3.1, 4)", org.apache.cxf.logging; version="[3.1, 4)", org.apache.cxf.message; version="[3.1, 4)", org.apache.cxf.phase; version="[3.1, 4)", org.apache.cxf.resource; version="[3.1, 4)", org.apache.cxf.security; version="[3.1, 4)", org.apache.cxf.service; version="[3.1, 4)", org.apache.cxf.service.factory; version="[3.1, 4)", org.apache.cxf.service.invoker; version="[3.1, 4)", org.apache.cxf.service.model; version="[3.1, 4)", org.apache.cxf.staxutils; version="[3.1, 4)", org.apache.cxf.staxutils.transform; version="[3.1, 4)", org.apache.cxf.transport; version="[3.1, 4)", org.apache.cxf.transport.http; version="[3.1, 4)", org.apache.cxf.transport.http.auth; version="[3.1, 4)", org.apache.cxf.transport.servlet; version="[3.1, 4)", org.apache.cxf.validation; version="[3.1, 4)", org.apache.cxf.ws.addressing; version="[3.1, 4)", org.apache.ws.commons.schema.constants; version="[2.2, 3)", org.ietf.jgss, org.osgi.framework; version="[1.5, 2)", org.osgi.service.blueprint.container; version="[1.0, 2)"; resolution:=optional, org.osgi.service.blueprint.reflect; version="[1.0, 2)"; resolution:=optional, org.w3c.dom, org.w3c.dom.ls, org.xml.sax, org.xml.sax.helpers

Manifest-Version: 1.0

Specification-Vendor: The Apache Software Foundation

Specification-Version: 3.1.10

Tool: Bnd-2.1.0.20130426-122213


Avatar

Level 10

For this 1 JAR (cxf-rt-frontend-jaxrs-3.1.10.jar) - have you tried to wrap this one in a separate OSGi bundle and deploy it?

Avatar

Level 2

Can you tell me how to? Do I need to rewrite the manifest as well?

Avatar

Level 10

I created an OSGi that contains just the cxf-rt-frontend-jaxrs-3.1.10.jar.  It deployed without an issue and did not effect other bundles. Look here...

Avatar

Level 2

Thank you so much for the help and video. I will try wrapping it now.

Though I am not sure how this will help as this bundles install ok and is active for me.

Problem is after installing this other 'Adobe' bundles break.

Use case:

0) Start AEM 6.4 (not 6.2)

1) install the cxf-rt-frontend-jaxrs-3.1.10.jar bundle.

2) check its active.

3) restart AEM

4) Check the logs and bundles

5) most of the Adobe ones are in Resolved or Installed state.

Avatar

Level 2

poomp51937612​ did you get resolve this issue? Even I am facing the same issue when AEM is updated from 6.3 to 6.4

Avatar

Level 2

Yes, had to remove the ref to this bundle from everywhere else. And then embed to only where it was required.