[英]Apache CXF WSDL FileNotFoundException
This is the plugin command I am using to generate java code from a WSDL with maven and cxf's wsdl2java codegen plugin: 这是我使用maven和cxf的wsdl2java codegen插件从WSDL生成Java代码的插件命令:
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<sourceRoot>${basedir}/target/srcgen</sourceRoot>
<wsdlOptions>
<wsdlOption>
<wsdl>${basedir}/src/main/resources/wsdl/ProjectService_1.0.wsdl</wsdl>
<serviceName>${ProjectService}</serviceName>
<extraargs>
<extraarg>-verbose</extraarg>
<extraarg>-autoNameResolution</extraarg>
<extraarg>-server</extraarg>
<extraarg>-impl</extraarg>
<extraarg>-p</extraarg>
<extraarg>com.company.project</extraarg>
</extraargs>
</wsdlOption>
</wsdlOptions>
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.8.1</version>
</dependency>
</dependencies>
</plugin>
This is the error I am getting: 这是我得到的错误:
Caused by: java.io.FileNotFoundException: /C:/workspace/wsdl2java/src/main/resources/wsdl/ProjectService_1.0.wsdl (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at java.io.FileInputStream.<init>(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.connect(Unknown Source)
at sun.net.www.protocol.file.FileURLConnection.getInputStream(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLEntityManager.setupCurrentEntity(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLVersionDetector.determineDocVersion(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
What am I doing wrong? 我究竟做错了什么? Is it in the code generation command or do I need to do something with CXF to give it the WSDL?
是在代码生成命令中,还是我需要对CXF进行一些操作以使其具有WSDL?
Does the WSDL file exist at this location ? WSDL文件是否存在于此位置?
<wsdl>${basedir}/src/main/resources/wsdl/ProjectService_1.0.wsdl</wsdl>
ie., C:/workspace/wsdl2java/src/main/resources/wsdl/ProjectService_1.0.wsdl 即C:/workspace/wsdl2java/src/main/resources/wsdl/ProjectService_1.0.wsdl
If not, copy the WSDL to this location or change the "<wsdl>" value to point to the WSDL file. 如果不是,则将WSDL复制到此位置或更改“ <wsdl>”值以指向WSDL文件。
解决方案是编辑CXF bean文件中引用的Impl对象,并确保它没有WSDL的硬编码路径。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.