在我的项目中,我使用的是 java 11。基于 WSDL 文件,我使用cxf-codegen-pluginMaven 插件生成代码类。java 11 上生成的类、使用javax.xml.ws.*和其他 API。例子 :extends Service 从该库生成的类之一javax.xml.ws.Service在 java 11 上并未弃用,但我遇到了兼容性错误。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]我怎样才能克服这个兼容性错误?
2 回答
富国沪深
TA贡献1790条经验 获得超9个赞
我遇到了同样的问题,cxf-codegen-plugin 3.3.5解决方案是使用 cxf 的依赖项而不是com.sun.xml.ws(或任何其他 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>
添加回答
举报
0/150
提交
取消