简体   繁体   English

为什么当我从 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?

I am generating classes in Maven Spring using我正在使用 Maven Spring 生成类

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

The clases are generated but when I try to call them tehy fail because of生成了类,但是当我尝试调用它们时,它们会失败,因为

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

I tried to add various dependencies to plugin and pom for example例如,我尝试向插件和 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>

But nothing helps.但没有任何帮助。 I tried both com.sun.xml.ws and org.codehaus.mojo versions of plugin我尝试了 com.sun.xml.ws 和 org.codehaus.mojo 版本的插件

full definition of plugin is插件的完整定义是

<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 files can be found athttps://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 Why is Maven generating method with 5 parameters instead of one from wsdl? wsdl files can be found athttps://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 Why is Maven generating method with 5 个参数而不是 wsdl 的一个参数?

What I need to add to resolve missing reference?我需要添加什么来解决缺少的参考?

Add a new dependency into you pom.xml在 pom.xml 中添加一个新的依赖项

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM