为什么当我从 jaxws-maven-plugin 生成 wsdl 类 时,由于缺少 ProviderImpl,它们在 运行 时无法 运行?

Why when I generate wsdl classes from jaxws-maven-plugin they fail to run at runtime because of missing ProviderImpl?

我正在使用

在 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

我试着给 plugin 和 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 (It is a different poject from different person but I am using same wsdls.) and bindig is explained

找到

我需要添加什么来解决缺少的引用?

给你添加一个新的依赖项pom.xml

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