的Apache CXF WSDL FileNotFoundException异常
问题描述:
这是我使用的生成与Maven和CXF的WSDL2Java的代码生成插件一个WSDL Java代码的插件命令:的Apache CXF WSDL FileNotFoundException异常
<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>
这是我收到的错误:
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)
我做错了什么?它是在代码生成命令还是我需要做一些与CXF的东西给它的WSDL?
答
该位置是否存在WSDL文件?
<wsdl>${basedir}/src/main/resources/wsdl/ProjectService_1.0.wsdl</wsdl>
即C:/workspace/wsdl2java/src/main/resources/wsdl/ProjectService_1.0.wsdl
如果没有,WSDL复制到此位置或更改“<WSDL> “指向WSDL文件的值。
答
解决方案是编辑CXF bean文件中引用的Impl对象,并确保它没有WSDL的硬编码路径。
这实际上是文件的位置吗? C:/workspace/wsdl2java/src/main/resources/wsdl/ProjectService_1.0.wsdl – 2012-01-31 16:15:00