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

ClassCastException with com.sun.org.apache.xerces.internal.dom.ElementNSImpl in Java 11 and cxf-bundle:2.7.18

    XMLWordPrintableJSON

Details

    • Unknown

    Description

      When upgrading Java 8 to 11, I am getting javax.xml dependency not found error. We are also generating java class from wsdl and xsd, using cxf-codegen plugin. That classes also uses these dependency. When tried adding the javax.xml dependency explicitly, the build was success but getting the following error while we are hitting the service.

       unwinding now
      java.lang.ClassCastException: class com.sun.org.apache.xerces.internal.dom.ElementNSImpl cannot be cast to class javax.xml.soap.SOAPElement (com.sun.org.apache.xerces.internal.dom.ElementNSImpl is in module java.xml of loader 'bootstrap'; javax.xml.soap.SOAPElement is in unnamed module of loader 'app')
              at org.apache.cxf.binding.soap.saaj.SAAJStreamWriter.adjustOverlaidNode(SAAJStreamWriter.java:67) ~[cxf-bundle-2.7.11.jar:2.7.11]
              at org.apache.cxf.staxutils.OverlayW3CDOMStreamWriter.writeStartElement(OverlayW3CDOMStreamWriter.java:188) ~[cxf-bundle-2.7.11.jar:2.7.11]
              at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.writeSoapEnvelopeStart(SoapOutInterceptor.java:127) ~[cxf-bundle-2.7.11.jar:2.7.11]
              at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:86) ~[cxf-bundle-2.7.11.jar:2.7.11]
              at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:66) ~[cxf-bundle-2.7.11.jar:2.7.11]
              at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272) ~[cxf-bundle-2.7.11.jar:2.7.11]
              at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:570) ~[cxf-bundle-2.7.11.jar:2.7.11]
              at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:479) ~[cxf-bundle-2.7.11.jar:2.7.11]
              at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:382) ~[cxf-bundle-2.7.11.jar:2.7.11]
              at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:335) ~[cxf-bundle-2.7.11.jar:2.7.11]
              at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96) ~[cxf-bundle-2.7.11.jar:2.7.11]
              at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:135) ~[cxf-bundle-2.7.11.jar:2.7.11]
      

      I am using cxf-bundle 2.7.18 and cxf-codegen 3.4.2. Also I am using org.jvnet.jaxb2.maven2:maven-jaxb2-plugin:0.14.0. 

      Java version : open-jdk 11.0.5 

      Attachments

        Activity

          People

            Unassigned Unassigned
            retheesh.kc Retheesh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: