Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
java
java
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.ws.rs.ext.ContextResolver;
import org.eclipse.persistence.jaxb.JAXBContextFactory;

public class MoxyJaxbContextResolved implements ContextResolver<JAXBContext> {

  org.eclipse.persistence.jaxb.JAXBContextFactory factory = new JAXBContextFactory();

  public JAXBContext getContext(Class<?> cls) {
      try {
          return factoryJAXBContextFactory.createContext(new Class[] {cls}, null);
      } catch (JAXBException ex) {
          throw new RuntimeException(ex);
      }
  }

}

Alternatively, add a "jaxb.properties" file with the entry "javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory" to a package where JAXB beans are located.

...