users@jaxb.java.net

Re: [ANN] JAXB 2.2 is released - Seriously?

From: bthayer <bthayer_at_tqs.com>
Date: Wed, 23 Dec 2009 10:27:57 -0800 (PST)

I Can't get 2.1 to work yet! I wish I could just add it to my program's jar
but using NetBeans it seems impossible. I finally gave up and created one
build (of my program) for Windows and one for Unix and told my users to
access the jar from a mapped network drive or Unix alias and hope it runs.

These instructions do not seem practical to me:

7.1.2. Using JAXB 2.1/2.2 with JavaSE 6

JavaSE 6 comes with JAXB 2.0 API in rt.jar, newer releases (since update 4)
of JavaSE 6 contain JAXB 2.1 API. Therefore, using JAXB 2.1/2.2 with JavaSE
6 requires one to override a portion of rt.jar with the new API. There are
several ways to do this:

   1. 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.

Fine for my PC but what about my users?

   2. 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.)

First you have to tell your users to use some advanced level argument on the
command line then make sure they type in the correct path. - not good for a
double-click crowd. My users are nervous double-clicking a jar file.

   3. 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.

Love to see a tutorial on this using NetBeans please.

No matter which approach you take, make sure not to include jar files other
than jaxb-api.jar. Doing so, for example including jaxb-xjc.jar, may result
in classloading related errors such as "taskdef A class needed by class
com.sun.tools.xjc.XJCTask cannot be found: org/apache/tools/ant/...."


 IMO - There's got to be a 4th approach. JAXB is difficult enough with
having to worry about deployment! Without some simpler way to get JAXB to
work I don't see new programmers adopting JAXB technology. I am always
looking for an alternative myself.


%-|


Martin Grebac wrote:
>
>
> If you want to work with the new JAXB api version on JDK 6 which itself
> contains older JAXB
> implementation, make sure you follow the endorsed dir setup as described
> in [4].
>
> [4]
> https://jaxb.dev.java.net/guide/Migrating_JAXB_2_0_applications_to_JavaSE_6.html#Using_JAXB_2_1_or_JAXB_2_2_with_JavaSE_6
> --
> Martin Grebac
> Sun Microsystems martin.grebac_at_sun.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
> For additional commands, e-mail: users-help_at_jaxb.dev.java.net
>
>
>
-- 
View this message in context: http://old.nabble.com/-ANN--JAXB-2.2-is-released-tp26744560p26905661.html
Sent from the java.net - jaxb users mailing list archive at Nabble.com.