Configure CXF JAX-WS service to work with MOXY
Asked Answered
H

1

1

Although I've added a jaxb.properties with MOXY factory and I see that the JAXB was switched to moxy, CXF has a method named createRIContext in the JAXBUtils class which loads hard coded the sun JAXB implementation.
Is there a way to override it and use moxy instead? The problematic code is the following:

// fall back if we're using another jaxb implementation
try {
     riContext = JAXBUtils.createRIContext(contextClasses
               .toArray(new Class[contextClasses.size()]), tns);
}

It loads hard coded the "com.sun.xml.bind.v2.ContextFactory" class and use it to create a JAXB context.

Hominid answered 29/11, 2012 at 16:44 Comment(7)
possible duplicate of How to use Moxy XPath annotated beans in web services?Adriell
Thanks for the link, but the link you provided discuss other implementations while my question is specifically on a CXF integration issue. In additional the idea of handling the xml directly (as suggested there) doesn't to me as a good direction.Hominid
The problem is with JAX-WS (JSR-224) implementations having proprietary hooks into the JAXB (JSR-222) implementations they use for XML binding. The Provider mechanism is a standard JAX-WS mechanism to plug in your own binding solution which would allow you to leverage EclipseLink JAXB (MOXy). MOXy is supported by the JAX-WS implementations in WebLogic and GlassFish.Adriell
I'm working with Spring / CXF. It seems that CXF is using sun implementation hard coded. See code bellow: // fall back if we're using another jaxb implementation try { riContext = JAXBUtils.createRIContext(contextClasses .toArray(new Class[contextClasses.size()]), tns); } Can you provide more information how the Provide mechanism can help me as a user of CXF to override the above code?Hominid
Is there any progress on this topic ? I'd also like to use CXF (jax-ws) with MOXY to make it work with JPA annotated classes.Oligarch
Not at the moment. It seems there nothing much to do beside rewrite the CXF code which use Sun's JAXB implementation.Hominid
@Oligarch see #22296116Hominid
R
1

The 3.0.0-milestone2 version of CXF should handle Moxy quite a bit better. That said, there are still bugs in Moxy that have prevented all of the CXF unit and system tests to pass with it so we don't have the same level of confidence with Moxy as we do with the JAXB RI.

(any help with testing 3.0.0 would be greatly appreciated)

Rightness answered 11/3, 2014 at 12:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.