Hello,

in our application, at one place, the eclipselink moxy library is used for
unmarshalling JSON content. The JAXB context for creating the unmarshaller
is set up in the usual way:

/jaxbContext = JAXBContext.newInstance(packageName, classLoader,
properties)/

The package with "packageName" contains a jaxb.properties file with
following entry:

/javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory/

and the eclipselink moxy library is installed and started as normal bundle
(version 2.7.1).

In the latest Karaf versions, the org.apache.servicemix.specs.jaxb-api-2.2
is under lib/endorsed, and config.properties set accordingly so the packages
from this jar are used instead of the respective JRE packages.

When creating the JAXB context, we always get the default factory, not the
one defined in the jaxb.properties file - and then setting the
"eclipselink.media-type" property of course fails. Looking bit deeper, it
seems that the ContextFinder in the javax.xml.bind package in the jaxb-api
jar combined with the OsgiLocator from the
org/apache/servicemix/specs/locator package in the same jar cannot find the
JAXB factory from eclipselink moxy, and then fall back to the default / use
the one from org.apache.servicemix.bundles.jaxb-impl-2.2.

Removing the jaxb-api jar from the lib/endorsed folder, adapting
config.properties accordingly, and installing the specs bundles "normally"
is not an option, since then the CXF feature which we use in other places
for REST interfaces does not work correctly any longer. Might be some class
path issue, but I haven't looked deeper into this.

Does somebody know a way out of this dilemma?

By the way: is there a trick to see the sources from endorsed libraries when
debugging from eclipse? By default, eclipse uses the code from the JDK,
which is of course annoying, since this is differing from the code in the
servicemix specs bundles. And taking the line numbers from eclipse and then
searching for the right place in the servicemix specs code in github is not
really comfortable .

Regards,
Jochen



--
Sent from: http://karaf.922171.n3.nabble.com/Karaf-User-f930749.html

Reply via email to