Issue
On my project I am using java 11.
based on a WSDL file, i generate code classes using cxf-codegen-plugin
maven plugin.
the classes generated, use javax.xml.ws.*
and other APIs on java 11.
example :
one of the generated Classes extends Service
which is from javax.xml.ws.Service
this library is not deprecated on java 11, but i have a compatibility error.
java.lang.IllegalArgumentException: JAXP09020005: The specified argument 'classpath:/schemas/wsdl' (case sensitive) for 'setRewritePrefix' is not valid.
at java.xml/javax.xml.catalog.CatalogMessages.reportIAE(CatalogMessages.java:140) ~[na:na]
at java.xml/javax.xml.catalog.BaseEntry.verifyURI(BaseEntry.java:231) ~[na:na]
at java.xml/javax.xml.catalog.RewriteSystem.setRewritePrefix(RewriteSystem.java:65) ~[na:na]
at java.xml/javax.xml.catalog.RewriteSystem.<init>(RewriteSystem.java:47) ~[na:na]
at java.xml/javax.xml.catalog.CatalogReader.startElement(CatalogReader.java:190) ~[na:na]
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:510) ~[na:na]
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:183) ~[na:na]
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:351) ~[na:na]
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2708) ~[na:na]
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:605) ~[na:na]
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112) ~[na:na]
at java.xml/com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:534) ~[na:na]
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:888) ~[na:na]
at java.xml/com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:824) ~[na:na]
at java.xml/com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) ~[na:na]
at java.xml/com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1216) ~[na:na]
at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:635) ~[na:na]
at java.xml/com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(SAXParserImpl.java:324) ~[na:na]
at java.xml/javax.xml.parsers.SAXParser.parse(SAXParser.java:276) ~[na:na]
at java.xml/javax.xml.catalog.CatalogImpl.parse(CatalogImpl.java:295) ~[na:na]
at java.xml/javax.xml.catalog.CatalogImpl.load(CatalogImpl.java:171) ~[na:na]
at java.xml/javax.xml.catalog.CatalogManager.catalog(CatalogManager.java:73) ~[na:na]
at java.xml/javax.xml.catalog.CatalogManager.catalogResolver(CatalogManager.java:119) ~[na:na]
at com.sun.xml.ws.util.xml.XmlCatalogUtil.createCatalogResolver(XmlCatalogUtil.java:125) ~[jaxws-rt-2.3.0.jar:2.3.0]
at com.sun.xml.ws.util.xml.XmlCatalogUtil.createDefaultCatalogResolver(XmlCatalogUtil.java:105) ~[jaxws-rt-2.3.0.jar:2.3.0]
... 38 common frames omitted
how can i overcome this compatibility error ?
Solution
I had the same problem with the cxf-codegen-plugin 3.3.5
and the solution was to use cxf's dependencies instead of com.sun.xml.ws
(or any other rt).
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>3.3.5</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>3.3.5</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>3.3.5</version>
</dependency>
Answered By - szab.kel
Answer Checked By - Senaida (JavaFixing Volunteer)