java—为什么我从jaxws maven插件生成wsdl类时,由于缺少providerimpl,它们在运行时无法运行?

iyr7buue  于 2021-07-06  发布在  Java
关注(0)|答案(1)|浏览(363)

我在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 (这是不同的人的不同观点,但我使用的是相同的wsdl。)bindig解释了为什么maven使用5个参数而不是wsdl中的一个参数来生成方法?
我需要添加什么来解决缺少的引用?

n3ipq98p

n3ipq98p1#

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

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

相关问题