【问题标题】:Why when I generate wsdl classes from jaxws-maven-plugin they fail to run at runtime because of missing ProviderImpl?为什么当我从 jaxws-maven-plugin 生成 wsdl 类时,由于缺少 ProviderImpl,它们无法在运行时运行?
【发布时间】:2021-04-11 01:15:27
【问题描述】:

我正在使用 Maven Spring 生成类

<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>

生成了类,但是当我尝试调用它们时,它们却失败了,因为

java.lang.Exception: Unexpected exception, expected<cz.project.common.exceptions.DataBoxException> but was<javax.xml.ws.WebServiceException>
Caused by: java.lang.ClassNotFoundException: com.sun.xml.internal.ws.spi.ProviderImpl

例如,我尝试向插件和 pom 添加各种依赖项

<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-ri</artifactId>
<version>2.3.1</version>                        
</dependency>

<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>rt</artifactId>
<version>2.3.2</version>
</dependency>

<dependency>
<groupId>com.sun.org.apache.xml.internal</groupId>
<artifactId>resolver</artifactId>
<version>20050927</version>
</dependency>

但没有任何帮助。我尝试了插件的 com.sun.xml.ws 和 org.codehaus.mojo 版本

插件的完整定义是

<plugin>
                <!--groupId>com.sun.xml.ws</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <version>2.3.2</version-->
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxws-maven-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <id>db</id>
                        <goals>
                            <goal>wsimport</goal>
                        </goals>
                        <configuration>
                            <xnocompile>false</xnocompile>
                            <!--useJdkToolchainExecutable>false</useJdkToolchainExecutable-->
                            <keep>true</keep>
                            <!--xadditionalHeaders>true</xadditionalHeaders-->
                            <wsdlFiles>
                                <wsdlFile>${basedir}/src/main/resources/wsdl/db_search.wsdl</wsdlFile>
                                <wsdlFile>${basedir}/src/main/resources/wsdl/db_access.wsdl</wsdlFile>
                            </wsdlFiles>
                            <bindingFiles>
                                <bindingFile>${basedir}/src/main/resources/wsdl/binding.xml</bindingFile>
                            </bindingFiles>
                            <packageName>cz.czechpoint.isds.v20.db</packageName>
                            <sourceDestDir>${project.build.directory}/generated-sources/wsdl/db</sourceDestDir>
                        </configuration>
                    </execution>
                    <execution>
                        <id>dm</id>
                        <goals>
                            <goal>wsimport</goal>
                        </goals>
                        <configuration>
                            <xnocompile>false</xnocompile>
                            <!--useJdkToolchainExecutable>false</useJdkToolchainExecutable-->
                            <keep>true</keep>
                            <!--xadditionalHeaders>true</xadditionalHeaders-->
                            <wsdlFiles>
                                <wsdlFile>${basedir}/src/main/resources/wsdl/dm_info.wsdl</wsdlFile>
                                <wsdlFile>${basedir}/src/main/resources/wsdl/dm_operations.wsdl</wsdlFile>
                            </wsdlFiles>
                            <bindingFiles>
                                <bindingFile>${basedir}/src/main/resources/wsdl/binding.xml</bindingFile>
                            </bindingFiles>
                            <packageName>cz.czechpoint.isds.v20.dm</packageName>
                            <sourceDestDir>${project.build.directory}/generated-sources/wsdl/db</sourceDestDir>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>

                    <dependency>
                        <groupId>com.sun.xml.ws</groupId>
                        <artifactId>jaxws-ri</artifactId>
                        <version>2.3.3</version>
                        <type>pom</type>
                    </dependency>

                    <dependency>
                        <groupId>com.sun.xml.ws</groupId>
                        <artifactId>rt</artifactId>
                        <version>2.3.2</version>
                    </dependency>

                    <dependency>
                        <groupId>com.sun.org.apache.xml.internal</groupId>
                        <artifactId>resolver</artifactId>
                        <version>20050927</version>
                    </dependency>
                </dependencies>
            </plugin>

wsdl 文件可以在https://github.com/dfridrich/CzechDataBox/tree/master/Resources 找到(这是来自不同人的不同项目,但我使用的是相同的 wsdls。)并且解释了 bindig Why is Maven generating method with 5 parameters instead of one from wsdl?

我需要添加什么来解决缺少的参考?

【问题讨论】:

    标签: java maven wsdl code-generation


    【解决方案1】:

    在 pom.xml 中添加新的依赖项

    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>jaxws-rt</artifactId>
        <version>2.3.3</version>
    </dependency>
    

    【讨论】:

    • 我在插件中添加了这个 javax.xml.wsjaxws-api2.3.1 version> com.sun.xml.wsjaxws-tools2.3.1 解决它
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-01-29
    • 1970-01-01
    • 2021-05-31
    • 1970-01-01
    • 1970-01-01
    • 2012-12-24
    相关资源
    最近更新 更多