> 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 classloader is in use MG>obviously when your container loads servlets ./WEB-INF/lib should take precendence in CLASSPATH MG>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 execution only java.endorsed.dirs will take precedence MG>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. > B�KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB��[��X��ܚX�KK[XZ[�\�\�][��X��ܚX�P[� > �\X�K�ܙ�B��܈Y][ۘ[��[X[��K[XZ[�\�\�Z[[� �\X�K�ܙ�B