users@jaxb.java.net

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

From: Martin Grebac <Martin.Grebac_at_Sun.COM>
Date: Mon, 04 Jan 2010 10:14:23 +0100

Hi,
 several people already replied, so adding my opinion as well. I
understand that using newer version of jaxb api on JDK with older
version is somewhat painful, however jaxb is using standard Java
extension mechanism. So I think you're asking Java to come up with
different extension mechanism.
 On the other hand, there are other options. JAXB is already integrated
into JDK, so just use the version from JDK - that way your customers
don't need any separate libraries, and there's no need for any
additional setup. JAXB 2.2 should come with JDK7.
 If you are a JDK licencee, AFAIK (you should check with your licencee
representative), you are entitled to get a smaller version of JDK
without JAXB/JAXWS (and some other libraries). With that one, you won't
get into endorsing trouble at all.
 As for NetBeans, JAXB 2.1.x is already integrated into NetBeans and I
develop JAXB 2.x in NetBeans and it works fine for me. Perhaps you need
to upgrade your NetBeans version? It would help if you could explain
your environment, versions, usecase and the kind of problems you're
facing. If you found a bug (either in NetBeans or JAXB), please submit
an issue with reproducible testcase to the issue tracker.

 MartiNG

bthayer wrote:
> 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
>>
>>
>>
>>

-- 
Martin Grebac, http://blogs.sun.com/mgrebac
Web Technologies & Standards
Sun Microsystems Czech
ICQ: 93478885