【问题标题】:Apache CXF WSDL FileNotFoundExceptionApache CXF WSDL FileNotFoundException
【发布时间】:2012-01-31 16:07:07
【问题描述】:

这是我用来从带有 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>

这是我得到的错误:

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?

【问题讨论】:

  • 这实际上是文件所在的位置吗? C:/workspace/wsdl2java/src/main/resources/wsdl/ProjectService_1.0.wsdl

标签: java wsdl cxf


【解决方案1】:

此位置是否存在 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 文件。

【讨论】:

    【解决方案2】:

    解决方案是编辑 CXF bean 文件中引用的 Impl 对象,并确保它没有指向 WSDL 的硬编码路径。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多