0

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]  
Aditya
  • 29
  • 3
  • You can't do that, compiling using higher version and running using lower version. Use the same version for compilation and runtime. Reverse is mostly possible, compile in lower version and running in higher version. – Rao May 26 '16 at 10:58
  • During compilation I am putting up the value inside javac tag like source="1.6" target="1.6" which make code compiled on 1.6 only, although java_home is jdk7/jdk8 etc. And I want to run the code on 1.6 only. Issue is Java_home is JDK7 which import files are not able to compiled. Now file generated by wsimport using JDK7 but during compilation (javac) I can control which java version should used from source and target - getting error during compilation. – Aditya May 26 '16 at 13:24
  • If you particular about run time version, why not use the same to compile, what is stopping you? – Rao May 26 '16 at 13:44
  • the build machine is on JDK7 but where we deploying our application that environment is on JDK6. – Aditya May 26 '16 at 14:11
  • It is better to sync the version if you need to proceed, that is only i can think of. – Rao May 26 '16 at 14:25

1 Answers1

0

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.

Aditya
  • 29
  • 3