Skip to main content

A story of migration from JAXB 1.0 to 2.0

Posted by kohsuke on August 5, 2005 at 3:13 PM PDT

Today, I've heard from JAXB's internal customers that they had a successful transition from JAXB 1.0 to 2.0. It was from Rebecca Searls, who's working on the migration tool of Sun Java System Application Server 8. I'm not particularly familiar with what this tool does, but it's a tool that helps you to migrate from other vendor's app server to Sun's app server.

Such a migration involves in reading and converting vendor-specific deployment descriptors, which are mostly XML. So naturally they wanted to find a simple way to read/write XML, and hence JAXB. Here's what they found:

JAXB 1.0 JAXB 2.0
# of schema files 62 62
# of JAXB customization files 14 7
# of generated Java files 8326 1084
size of the compiled class files 66407K 3685K

Notice the huge improvements in the footprint (66M->4M). It's partly because we no longer generate unmarshaller/marshaller/validator, it's partly because the spec team and the EG worked hard to reduce the number of classes we generate.

Rebecca also listed the following benefits:

  1. No more ObjectFactory.createXYZ. The problem with those factory methods was that they throw a checked JAXBException. Now you can simply do new XYZ(), no more try/catch blocks. (I know, I know, ... this is one of those "what were we thinking!?" things)

  2. Less customization files = less things to worry about.