I think I may not have articulated my problem correctly. I am using WAS 8.5 JDK 1.7 set-up as general build set-up for my ANT, but for this particular application, it uses separate JAXB1.0 jars on JAXB 1.0 generated classes. It includes 4 jaxb jars in the web-inf/lib - so I basically need to go back to 1.0 version in my javac step for the application.
So, if I use the endorsed jvm property for a backward version, will it work and do I have copy just the jaxb-api.jar to that directory? The web-inf/lib contains jaxb-api.jar, jaxb-impl.jar, jaxb-xjc.jar and jaxb-libs.jar and some other jars used by the application. -----Original Message----- From: Martin Gainty [mailto:mgai...@hotmail.com] Sent: Monday, September 15, 2014 5:39 PM To: Ant Users List Subject: RE: Need help with ANT javac classpath > From: webservices_developm...@csx.com > To: user@ant.apache.org > Subject: RE: Need help with ANT javac classpath > Date: Mon, 15 Sep 2014 16:06:55 +0000 > > Thanks. > > This is a common build script that we have, so I didn't add fork for the > javac task - as it would affect other builds as well, that use the latest > java version and follow the default build. > > If it is not possible at all to incorporate something in the common build, I > will take a look at separating this one out, but want to avoid it, if I can. > > I had looked at the endorsed directory, but I got the impression that it is > to be used when you want to use a later version, not earlier. Is that not > true? Also, if I can use it for earlier version, can I use the JAXB jars > from the WEB-INF/lib directory for the path for - > Djava.endorsed.dirs=/relative-path-to/WEB-INF/lib? Would other jars in that > location cause any issues for endorsed directory? > MG>as stated earlier which JAXB jar is loaded depends on which MG>classloader is in use obviously when your container loads servlets MG>./WEB-INF/lib should take precendence in CLASSPATH Dominiques link to Glassfish has the best solution: MG>https://jaxb.java.net/guide/Migrating_JAXB_2_0_applications_to_JavaSE_6.html#Using_JAXB_2_1_or_JAXB_2_2_with_JavaSE_6 MG>to resolve correct version of JAXB either: Place the 2.1/2.2 jaxb-api.jar into $JRE_HOME/lib/endorsed. This essentially makes your JRE to "JRE 6 + JAXB 2.x". This won't affect any other applications that use this JRE, and it's easy. On the other hand, in various scenarios you may not be able to alter the JRE. Use the system property java.endorsed.dirs when you launch your application, and have it point to the directory that contains the 2.1/2.2 jaxb-api.jar. This allows you use use JAXB 2.1/2.2 without modifying the JRE. Make sure not to include any other JAXB RI jar files (such as jsr173-api.jar or jaxb-impl.jar.) Implement a custom ClassLoader and block delegation to javax.xml.bind package, so that code running inside this class loader will load the JAXB API from elsewhere. This is a very advanced approach. MG>-Djava.endorsed.dirs= has the least side-effects which says for this MG>execution only java.endorsed.dirs will take precedence HTH -----Original Message----- > From: Dominique Devienne [mailto:ddevie...@gmail.com] > Sent: Monday, September 15, 2014 11:30 AM > To: Ant Users List > Subject: Re: Need help with ANT javac classpath > > On Mon, Sep 15, 2014 at 5:15 PM, WebServices Development < > webservices_developm...@csx.com> wrote: > > > P.S - I tried adding includejavaruntime="false" and > > includeantruntime="false" attributes - both together as well as > > individually - to the javac task - but I still get the error. The > > error is - createBinder() in ObjectFactory cannot override > > createBinder() in JAXBContext > > > > Did you fork="true" too, for <javac>? That way you can have better control of > the environment the JDK javac (implemented in Java) runs with, separate the > from environment Ant itself runs in. > > Also look into > http://docs.oracle.com/javase/6/docs/technotes/guides/standards/ > > A quick Google also turned up > http://stackoverflow.com/questions/16215409/is-it-possible-to-replace- > the-version-of-the-jaxb-implementation-in-java-jre-1-6 > > --DD > This email transmission and any accompanying attachments may contain CSX privileged and confidential information intended only for the use of the intended addressee. Any dissemination, distribution, copying or action taken in reliance on the contents of this email by anyone other than the intended recipient is strictly prohibited. If you have received this email in error please immediately delete it and notify sender at the above CSX email address. Sender and CSX accept no liability for any damage caused directly or indirectly by receipt of this email.