Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-9041

Regression: CXF will only accept org.glassfish.jaxb.runtime.v2.ContextFactory

Details

    • Unknown

    Description

      Found via: https://github.com/OpenLiberty/open-liberty/issues/28414

      Excerpt from an IBM case:

      [..] the post-update problem is caused by their third-party Web Service implementation (Apache CXF 4.0). CXF had a similar issue with the XML Binding specification look up algorithm, which they addressed by hard coding their own dependency on the XML Binding Reference implementation. This is the code from JAXBUtils.java:

          public static JAXBContext createContext(final Set<Class<?>> classes,
                                                  final Map<String, Object> map) throws JAXBException {
              JAXBContext ctx = null;
              try {
                  ctx = AccessController.doPrivileged(new PrivilegedExceptionAction<JAXBContext>() {
                      public JAXBContext run() throws Exception {
                          //This is a workaround for CXF-8675
                          Class<?> factoryClass = ClassLoaderUtils.loadClass("org.glassfish.jaxb.runtime.v2.ContextFactory",
                                  JAXBContextCache.class);
                          Method m = factoryClass.getMethod("createContext", Class[].class, Map.class);
                          Object context = m.invoke(null, classes.toArray(new Class<?>[0]), map);
                          return (JAXBContext) context;
                      }
                  });
              } catch (PrivilegedActionException e2) {
                  if (e2.getException() instanceof JAXBException) {
                      JAXBException ex = (JAXBException) e2.getException();
                      throw ex;
                  } else {
                      throw new RuntimeException(e2.getException());
                  }
              }
              return ctx;
          }
      

      In the developers opinion, this was a terrible fix on Apache CXF's part, since they've introduced a hard dependency on a specific implementation of XML Binding, rather then allowing a user to provide their own implementation (which is how its always been in the past, and its how our xmlWS-4.0 feaeture is written).

      Confirmed by rmannibucau (Regression):

      Attachments

        1. jaxb-no-fallback.png
          159 kB
          Benjamin Marwell

        Issue Links

          Activity

            There are no comments yet on this issue.

            People

              reta Andriy Redko
              bmarwell Benjamin Marwell
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: