I'm running IntelliJ with Java 6 to build my project. I'm doing a clean checkout via SVN and trying to do a mvn clean install
It runs successfully but then when I try to deploy my application I get a compile time error. It says that I'm trying to use a constructor that doesn't exist.
Specifically, I'm trying to use a constructor from Here . This constructor is NOT in the Java 5 version. But for some reason, the .class file in my jdk 1.6 install appears to be the Java 5 version. The location of the .class file is /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Classes/classes.jar!/javax/xml/ws/Service.class
and that path was copied directly from IntelliJ when I drill down .
Here is the decompiled code from 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 */ }
}
}
Can anyone explain what is going on?
Edit #1: It doesn't error at deploy, its errors at compile time. I communicated that poorly above. You can see the red squiggles in IntelliJ. When I try to drill down on the constructor, it shows me the decompiled code seen above. The issue is that it does NOT look like the Java 6 class, it appears to be the Java 5 class but it is in my Java 6 SDK. Also, someone pointed out that the constructor is protected so I can't use it. However, my class extends service so its allowed to use the constructor.
Output from mvn -v
<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"
Edit #2: @Didier Yeah, I can get around it by using the Jaxb and jaxws version of Service.class Thanks for that. But I'm more interested in why this class in my Java 6 SDK is failing when the API says it should have the constructor