Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/327.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么我的Java6JDK中的这个类看起来像Java5版本?_Java_Maven_Intellij Idea_Intellij 13 - Fatal编程技术网

为什么我的Java6JDK中的这个类看起来像Java5版本?

为什么我的Java6JDK中的这个类看起来像Java5版本?,java,maven,intellij-idea,intellij-13,Java,Maven,Intellij Idea,Intellij 13,我正在用Java6运行IntelliJ来构建我的项目。我正在通过SVN进行清理签出,并尝试执行mvn清理安装它成功运行,但当我尝试部署应用程序时,我得到了一个编译时错误。它说我试图使用一个不存在的构造函数 具体地说,我正在尝试使用来自的构造函数。此构造函数不在Java 5版本中。但出于某种原因,我的JDK1.6安装中的.class文件似乎是Java 5版本。.class文件的位置是/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Content

我正在用Java6运行IntelliJ来构建我的项目。我正在通过SVN进行清理签出,并尝试执行
mvn清理安装
它成功运行,但当我尝试部署应用程序时,我得到了一个编译时错误。它说我试图使用一个不存在的构造函数

具体地说,我正在尝试使用来自的构造函数。此构造函数不在Java 5版本中。但出于某种原因,我的JDK1.6安装中的.class文件似乎是Java 5版本。.class文件的位置是
/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/Classes.jar/javax/xml/ws/Service.class
,当我向下搜索时,该路径是直接从IntelliJ复制的

以下是IntelliJ的反编译代码

  // IntelliJ API Decompiler stub source generated from a class file
  // Implementation of methods is not available

package javax.xml.ws;

public class Service {
    private javax.xml.ws.spi.ServiceDelegate delegate;

    protected Service(java.net.URL url, javax.xml.namespace.QName qName) { /* compiled code */ }

    public <T> T getPort(javax.xml.namespace.QName qName, java.lang.Class<T> aClass) { /* compiled code */ }

    public <T> T getPort(javax.xml.namespace.QName qName, java.lang.Class<T> aClass, javax.xml.ws.WebServiceFeature... webServiceFeatures) { /* compiled code */ }

    public <T> T getPort(java.lang.Class<T> aClass) { /* compiled code */ }

    public <T> T getPort(java.lang.Class<T> aClass, javax.xml.ws.WebServiceFeature... webServiceFeatures) { /* compiled code */ }

    public <T> T getPort(javax.xml.ws.EndpointReference endpointReference, java.lang.Class<T> aClass, javax.xml.ws.WebServiceFeature... webServiceFeatures) { /* compiled code */ }

    public void addPort(javax.xml.namespace.QName qName, java.lang.String s, java.lang.String s1) { /* compiled code */ }

    public <T> javax.xml.ws.Dispatch<T> createDispatch(javax.xml.namespace.QName qName, java.lang.Class<T> aClass, javax.xml.ws.Service.Mode mode) { /* compiled code */ }

    public <T> javax.xml.ws.Dispatch<T> createDispatch(javax.xml.namespace.QName qName, java.lang.Class<T> aClass, javax.xml.ws.Service.Mode mode, javax.xml.ws.WebServiceFeature... webServiceFeatures) { /* compiled code */ }

    public <T> javax.xml.ws.Dispatch<T> createDispatch(javax.xml.ws.EndpointReference endpointReference, java.lang.Class<T> aClass, javax.xml.ws.Service.Mode mode, javax.xml.ws.WebServiceFeature... webServiceFeatures) { /* compiled code */ }

    public javax.xml.ws.Dispatch<java.lang.Object> createDispatch(javax.xml.namespace.QName qName, javax.xml.bind.JAXBContext jaxbContext, javax.xml.ws.Service.Mode mode) { /* compiled code */ }

    public javax.xml.ws.Dispatch<java.lang.Object> createDispatch(javax.xml.namespace.QName qName, javax.xml.bind.JAXBContext jaxbContext, javax.xml.ws.Service.Mode mode, javax.xml.ws.WebServiceFeature... webServiceFeatures) { /* compiled code */ }

    public javax.xml.ws.Dispatch<java.lang.Object> createDispatch(javax.xml.ws.EndpointReference endpointReference, javax.xml.bind.JAXBContext jaxbContext, javax.xml.ws.Service.Mode mode, javax.xml.ws.WebServiceFeature... webServiceFeatures) { /* compiled code */ }

    public javax.xml.namespace.QName getServiceName() { /* compiled code */ }

    public java.util.Iterator<javax.xml.namespace.QName> getPorts() { /* compiled code */ }

    public java.net.URL getWSDLDocumentLocation() { /* compiled code */ }

    public javax.xml.ws.handler.HandlerResolver getHandlerResolver() { /* compiled code */ }

    public void setHandlerResolver(javax.xml.ws.handler.HandlerResolver handlerResolver) { /* compiled code */ }

    public java.util.concurrent.Executor getExecutor() { /* compiled code */ }

    public void setExecutor(java.util.concurrent.Executor executor) { /* compiled code */ }

    public static javax.xml.ws.Service create(java.net.URL url, javax.xml.namespace.QName qName) { /* compiled code */ }

    public static javax.xml.ws.Service create(javax.xml.namespace.QName qName) { /* compiled code */ }

    public static enum Mode {
        MESSAGE, PAYLOAD;

        public static javax.xml.ws.Service.Mode[] values() { /* compiled code */ }

        public static javax.xml.ws.Service.Mode valueOf(java.lang.String s) { /* compiled code */ }

        private Mode() { /* compiled code */ }
    }
}

编辑#2:@Didier是的,我可以通过使用Service.class的Jaxb和jaxws版本来解决这个问题,谢谢。但是我更感兴趣的是,为什么我的Java6SDK中的这个类失败了,因为API说它应该有构造函数,JDK6中包含的实际的
javax.xml.ws.Service
是来自JAXB/JAX-WS2.0的,并且没有这个构造函数。实际文档是

您正在参考JavaEE6的文档,其中包括带有新构造函数的JAXB/JAX-WS2.1


您应该能够解决以下问题。另请参见。

部署到具体位置?通过部署到例如JBoss4.2.X,我遇到过类似的问题。您可能还意外地在应用程序中部署了一个旧版本的API jar,因为它是一个可传递的Maven依赖项java的哪个版本是
mvn
使用的?(请显示
mvn-v
的输出)
我试图部署我的应用程序,但遇到编译时错误。它说我试图使用一个不存在的构造函数。
这听起来像是一个运行时错误,因为您要部署的机器运行的是Java 5.0。我之前的评论大多站得住脚——您的Maven编译类路径上可能有一个旧版本的jar,需要排除它。做一个mvn dependency:tree,看看里面有什么,以及哪些是通过传递方式添加到Maven dependencies中的。我不在乎你没有特别提到的文档说了什么——你描述的问题具有类路径冲突的所有特征,因此除非你努力证明事实并非如此,这就是我想相信的事实——Occam的剃须刀。我认为Java6包含与JEE5相同的类(请参阅)。Java5根本不包括这个类,我几乎总是交替使用这两个文档。这次咬了我的屁股。谢谢
<machine_name>:record-replay carlos$ mvn -v
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 08:51:28-0500)
Maven home: /Users/carlos/workspace/dev/apache-maven/current
Java version: 1.6.0_65, vendor: Apple Inc.
Java home: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
Default locale: en_US, platform encoding: MacRoman
OS name: "mac os x", version: "10.9.4", arch: "x86_64", family: "mac"