Skip to main content

JAXB 2.2 Proposed Changes

Posted by kohsuke on June 3, 2008 at 10:17 AM PDT

The JAXB spec is planning a very small maintenance review (MR) as a part of JavaEE 6. There are several big ticket RFE items that we wanted to do, like better support for interfaces, but in the end we felt that given the finite resources we have, JAXB is probably in a better shape compared to some other technologies.

So this MR is a very small one, mainly to introduce a new security permission necessary for the use inside JavaSE. It also has a few enhancements to annotations. You can also see the proposed changes.

On the RI side, I'm planning to pull off an interesting trick — we are only going to produce a single set of jars, and when you use it with the JAXB 2.1 API, it will work as JAXB 2.1 implementation, and when you use it with the JAXB 2.2 API, it will work as JAXB 2.2 implementation. You'll see two downloadables (2.1 bundle and 2.2 bundle), but their jaxb-impl.jar and jaxb-xjc.jar is bit-by-bit equivalent, and the only difference is the jaxb-api.jar bundled with it and release note documentations.

For us, this means we don't have to maintain multiple branches. We'll fix a bug in just one place, and it will be available in all our releases simultaneously. This in turn allows us to sustain 2.1.x lines for a long time to come. Because JavaSE will only update to JAXB 2.2 in JavaSE 7, it's important not to force the users to upgrade to 2.2, or else we'll get into the endorsed directory fiasco all over again. And this is where the trick becomes useful to you.

I expect/hope Metro to follow this as well, although that's not committed. A part of the reason 2.0 > 2.1 migration was so painful was that people were forced to upgrade to JAX-WS 2.1 because the rearchitectured modern pluggable runtime was only available in the 2.1 release, and so despite the fact that there aren't too many spec level improvements, people needed the 2.1 implementation. We really need to avoid repeating this again.

And as I announced a week ago, going forward I'll be moving away from JAXB, once 2.2 is wrapped up. Martin Grebac will be the new JAXB lead.

Related Topics >>


I am facing a problem running JAXB code within a JMX MBean. Any samples you may have for this combination would certainly help...I can send my code samples too, if you can spend some time. The code is generating incomplete/empty XML files. When run as a stand-alone program, everything works fine. It's just with JMX that I am facing this problem.

jasonchaffee -- Yes, there are a plugin that lets you do that, I think. Maybe it's something you wrote, I don't remember. Thank you for your kind word.

I too agree that interface support would be nice, but I found a way to work around it by extending the JAXB generated classes and having those classes implement my defined interfaces. This allows me to design and code against interfaces and protect myself against underlying schema changes as much as possible. BTW, Kohsuke I am sad to see you leave the JAXB project as it one my favorite Java projects and you have done a great job. However, I look forward to the same effort on Hudson...another favorite of mine.

Comment not related to this item, but a general comment about the blog style. I am just new to jax-ws and jaxb usage. While reading many related blogs, I came across your blog and I instanly liked the style (all the blogs at one place, helping users to reduce the number of clicks, and also we can see all the info at one place...). A very good idea.

Dear Kohsuke Kawaguchi, we were working with XFire (using MyEclipse wizards) till now, it had a support for interfaces. I was forced to switch to JAX-WS because MyEclipse wizards on XFire failed on me. I'm really a devotee of interfaces, and I found my self now changing a big portion of my communication packages code in order to remove interfaces. the architect of JAX-B has to make the design effort to support interfaces! it's sound big but since JAX-WS should be the standard webservices in Java EE, the entire java world is on your shoulders! please make the effort, others has done it. please do it too! best, Shahar Daniel

Thank you for your comment, Shahar. If there'll be JAXB 3.0, I'm sure it'll be the top of the list.