我正在使用Netbeans 7和Maven 2.2.1以及jaxws-maven-plugin 1.12.代码部署在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,当客户端尝试使用三个参数调用超类构造函数时,将引发错误.由于超类没有任何带有三个参数的构造函数,因此失败.
javax.xml.ws.Service在JDK SE 1.6和JAX-WS 2.1中找到错误的版本.
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>
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Apache CXF附带的wsdl2java工具生成Web服务代理.生成本身似乎很好,但生成的文件中有一些错误,调用一个不存在的构造函数.
该文件提供了解决方案:
//This constructor requires JAX-WS API 2.2. You will need to endorse the 2.2
//API jar or re-run wsdl2java with "-frontend jaxws21" to generate JAX-WS 2.1
//compliant code instead.
Run Code Online (Sandbox Code Playgroud)
所以我开始下载并安装2.2版本的JAX-WS Api.我找到了以下安装手册,解释了如何认可这些新文件:http://dcx.sybase.com/1200/en/dbprogramming/httpserver-jaxws-lesson-two.html我按照本指南的每一步,删除了旧的生成的文件和生成的新文件,但问题仍然存在.
任何提示和/或技巧?(当然,我现在使用-frontend jaxws21标志来生成代理,但仍然如此).