I'm trying to generate a wsdl file from Java classes using Eclipse Oxigen (Right Click on class -> WebService -> Create Web Service) , Java 8u152 runtime and Tomcat 7.
With the following settings:
I have fed Eclipse with the CXF 3.2.2 jar (the same happens with 2.2.9 and 2.3.1).
I get the following error:
JavaToWS Error: java.lang.AbstractMethodError: javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V
java.lang.AbstractMethodError: javax.xml.parsers.DocumentBuilderFactory.setFeature(Ljava/lang/String;Z)V
at org.apache.cxf.helpers.DOMUtils.getDocumentBuilder(DOMUtils.java:108)
at org.apache.cxf.helpers.DOMUtils.createDocument(DOMUtils.java:148)
at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:1181)
at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:1178)
at org.apache.cxf.staxutils.StaxUtils.read(StaxUtils.java:1139)
at org.apache.cxf.tools.common.dom.ExtendedDocumentBuilder.parse(ExtendedDocumentBuilder.java:100)
at org.apache.cxf.tools.common.toolspec.ToolSpec.<init>(ToolSpec.java:73)
at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:87)
at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:58)
at org.apache.cxf.tools.common.toolspec.ToolRunner.runTool(ToolRunner.java:40)
at org.apache.cxf.tools.java2ws.JavaToWS.run(JavaToWS.java:78)
at org.apache.cxf.tools.java2ws.JavaToWS.main(JavaToWS.java:46)
And it does not generate anything but an unwanted cxf-beans.xml.
Am I missing something?
It's possible exists a problem with "xml-apis" or "xmlParserAPIs" on the classpath
you due to verify your version for it has the method javax.xml.parsers.DocumentBuilderFactory.setFeature(String )
.
For example, the first version with method in xml-apis is 1.4.01
In my case the problem was caused by xerces jar which was included in the classpath. I searched for it in Dependency Hierarchy of pom.xml and I have removed the artifact for xerces jar.
<exclusion>
<groupId>batik</groupId>
<artifactId>xerces</artifactId>
</exclusion>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.