Thanks for the hints Stephan. They got me going in the right direction.

My problems went away after I added these to my launchpad¹s list.xml:

<bundle>
  <groupId>javax.xml.bind</groupId>
  <artifactId>jaxb-api</artifactId>
  <version>2.2.11</version>
</bundle>
                <bundle>
  <groupId>com.sun.xml.bind</groupId>
  <artifactId>jaxb-core</artifactId>
  <version>2.2.11</version>
                </bundle>

I¹m not entirely sure what was causing the problem, but there seems to be
some inconsistency in module naming in this area.


With the above bundles specified, the felix console bundles now include:

Old JAXB Core com.sun.xml.bind.jaxb-core 2.2.11 Active
jaxb-api jaxb-api 2.2.11 Active


Manually forcing these to load at launchpad start time satisfied the later
bundle load-time dependencies.

-Bruce


>the packages javax.xml.bind.* are part of the java runtime (at least for
>the newer JDKs 7 and up), but not exported by the OSGi system bundle by
>default.
>
>if not done already please install the bundle
>org.apache.sling:org.apache.sling.fragment.xml:1.0.2 and restart the
>instance, this extends the list of exported packages of the java runtime
>for the XML-related packages. but this package currently only exports
>JAXB version 2.1.0, can you downgrade to this version? as a rule of thumb
>you should always try to use the packages von the java runtime if they
>are included in the version you use and install the appropriate fragment
>bundle that extends the export list.
>
>packages starting with com.sun.xml are internal-only packages, are not
>exported by the system bundle in general and should not be used.
>
>if you really have to update JAXB to a newer version than this can become
>cumbersome, because those libraries tend to import packages like
>com.sun.xml which are not exported and have dependencies which might be
>difficult to resolve.
>
>stefan
>
>>
>>I'm running into this error trying to use jaxb in a bundle:
>>
>>com.sun.xml.bind -- Cannot be resolved and overwritten by Boot Delegation
>>com.sun.xml.bind.annotation -- Cannot be resolved and overwritten by Boot
>>Delegation
>>javax.xml.bind,version=[2.2,3) -- Cannot be resolved
>>javax.xml.bind.annotation,version=[2.2,3) -- Cannot be resolved
>>
>>I assume I need to replace the standard jaxb-core and jaxb-api with the
>>osgi
>>variants (jaxb-osgi and jaxb-osgi-extra?), but I haven't found the magic
>>incantation for the maven-bundle-plugin to get this to load in sling.
>>
>>What is the procedure for declaring jaxb as a bundle dependency in the
>>pom.xml?
>>
>>-Bruce
>

Reply via email to