Search code examples
javaantjax-wsjava-7java-6

Error due to wsimport on JDK7 and JAVAC support JDK6 - compatibility issue


I am using ANT 1.6 /JAX-WS 2.0/Weblogic 11g in my project. I got requirement where our build machine is on JDK7 but our deployment machine (include weblogic) is on JDK6. Now I am getting an error while creating war file.

Steps - Before creating war file in build.xml file:

1) I am calling wsimport with JDK7 as default java home is JDK7 (because build machine is now on JDK7) where I am setting -Xnocompile so the source code is not compiled with default JDK7.

2) During execution of javac where I have specified property [source ="6" target="6" fork="false"|"true" (both combination of fork one at a time)] to make build compatible with JDK6. However, I am getting error while reading the code generated by wsimport.

The issue is what I understood so far - we are doing wsimport from JDK7 and compile the code with setting the property as JDK6. So JDK7's generated java files are not supported during javac execution.

I am getting similar error like below - FYI, ADMIN.java file generated by wsimport command in my build.xml file.

 C:\MyProject\src\com\company\abc\xyz\delivery\ws\ADMIN.java:46: 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
    [javac]         super(__getWsdlLocation(), ADMIN_QNAME, features);<br>
    [javac]  

Solution

  • It's not possible to fix the above issue anyway apart from change the Java_home option of our build machine and point to JDK6 or your running java version.