我尝试使用JavaSE 1.6在Eclipse中编译Web服务项目。
在项目中,我使用了很多从WSDL创建的类。
The error message is:
cannot find symbol
[javac] symbol : constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature[])
[javac] location: class javax.xml.ws.Service
源代码(来自WSDL的编译类:
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.2.4-b01
* Generated source version: 2.2
*
*/
.....
public IfaceService(WebServiceFeature... features) {
**super(__getWsdlLocation(), IFACESERVICE_QNAME, features);**
}
I read in another tread there are problems with JAX-WS version 2.1 in some cases. Therefore I tried different versions in the ivy config file.
<info organisation="de.os.osvk.ech" module="my Project"
status="integration" revision="0.1">
</info>
<dependencies>
<dependency org="com.google.inject" name="guice" rev="3.0"/>
<dependency org="com.google.inject.extensions" name="guice-servlet" rev="3.0"/>
<dependency org="org.glassfish.ha" name="ha-api" rev="3.1.8">
<artifact name="ha-api" ext="jar" type="jar"/>
<exclude org="com.sun.enterprise" module="hk2"/>
</dependency>
<dependency org="com.sun.xml.ws" name="jaxws-tools" rev="2.2.7"/>
<dependency org="javax.ws.rs" name="jsr311-api" rev="1.1.1"/>
<dependency org="com.sun.jersey" name="jersey-core" rev="1.7" />
<dependency org="javax.transaction" name="jta" rev="1.1"/>
<dependency org="javax.xml.ws" name="jaxws-api" rev="2.1.1"></dependency>
<dependency org="org.quartz-scheduler" name="quartz" rev="1.7.3" conf="*->*,!sources">
<exclude org="javax.ejb" />
<exclude org="javax.mail" />
<exclude org="javax.servlet" />
<exclude org="org.apache.openejb" />
<exclude org="junit" />
<exclude org="javax.jms" />
</dependency>
<dependency org="xalan" name="xalan" rev="2.7.1"/>
<dependency org="org.eclipse.jetty" name="jetty-servlet" rev="7.4.4.v20110707"/>
</dependencies>
</ivy-module>
我必须使用哪个版本的javax.xml.ws or jaxax.xml.binding
zu编译JAX-WS RI 2.2.4-b01 (Java code from WSDL)
?
答案 0 :(得分:0)
dependency org="javax.xml.ws" name="jaxws-api" rev="2.1.1"
很可疑 - 您可能需要2.2.x.但是,Java SE 6包含旧版本的JAX-WS API。您可能需要阅读https://weblogs.java.net/blog/ramapulavarthi/archive/2009/04/tip_for_using_j.html
答案 1 :(得分:0)
您应该使用jdk1.6.0_35来生成WSDL。
答案 2 :(得分:0)
在%JAVA_HOME%\ jre \ lib \ endorsed 中单独添加 webservices-api-2.2.jar 已解决了我的问题。