【问题标题】:cannot find symbol in constructor Service在构造函数服务中找不到符号
【发布时间】:2013-06-17 08:20:25
【问题描述】:

我尝试在 Eclipse 中使用 JavaSE 1.6 编译一个 webservice 项目。

在项目中,我使用了很多从 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 的哪个版本我必须针对JAX-WS RI 2.2.4-b01 (Java code from WSDL) 使用zu compile?

【问题讨论】:

    标签: java eclipse web-services jax-ws


    【解决方案1】:

    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

    【讨论】:

      【解决方案2】:

      您应该使用 jdk1.6.0_35 来生成 WSDL。

      【讨论】:

        【解决方案3】:

        %JAVA_HOME%\jre\lib\endorsed 中单独添加 webservices-api-2.2.jar 已为我解决了问题。

        【讨论】:

          猜你喜欢
          • 2012-12-17
          • 1970-01-01
          • 2013-01-16
          • 2012-05-23
          • 1970-01-01
          • 2018-04-13
          • 2017-03-21
          • 1970-01-01
          • 2010-10-05
          相关资源
          最近更新 更多