我正在使用带有 Maven 2.2.1 和 jaxws-maven-plugin 1.12 的 Netbeans 7。代码部署在 Glassfish 3.1 上 - 或者将在我编译时部署 :)
当我构建项目时,wsimport 按预期运行并从提供的 WSDL 生成源文件。问题是在编译阶段构建失败,以下三个异常。通过对此的研究,我看到这些构造函数是从 JAX-WS 2.1 添加到 JAX-WS 2.2 的。我的信念是 wsimport 使用的是 JAX-WS 2.1,而编译器使用的是 JAX-WS 2.2。
有人可以证实我的怀疑吗?或者,如果我错了,您可能知道是什么原因造成的吗?
谢谢你。
问题的更新/澄清 Web 服务客户端扩展 javax.xml.ws.Service 并且当客户端尝试使用三个参数调用超类构造函数时引发错误。由于超类没有任何带有三个参数的构造函数,因此它失败了。
在 JDK SE 1.6 和 JAX-WS 2.1 中发现 javax.xml.ws.Service 是错误的版本。
javax.xml.ws.Service 在 JAX-WS 2.2 中是正确的版本。
该错误发生了三次,因为它位于三个被覆盖的构造函数中,但它是相同的错误,所以我只包含了一次。
cannot find symbol
symbol : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])
location: class javax.xml.ws.Service
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.12</version>
<executions>
<execution>
<goals>
<goal>wsimport</goal>
</goals>
<configuration>
<wsdlFiles>
<wsdlFile>*path to WSDL*</wsdlFile>
</wsdlFiles>
<wsdlLocation>*url to WSDL*</wsdlLocation>
<staleFile>${project.build.directory}/jaxws/stale/BudgetCheckingServiceService.stale</staleFile>
</configuration>
<id>wsimport-generate-BudgetCheckingServiceService</id>
<phase>generate-sources</phase>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-tools</artifactId>
<version>2.2.6-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>webservices-api</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<configuration>
<sourceDestDir>${project.build.directory}/generated-sources/jaxws-wsimport</sourceDestDir>
<xnocompile>true</xnocompile>
<verbose>true</verbose>
<extension>true</extension>
<catalog>${basedir}/src/jax-ws-catalog.xml</catalog>
</configuration>
</plugin>