Page 1 of 1

Could replace JAXB RI to other implementation?

PostPosted: Fri Nov 11, 2011 7:24 pm
by ronnie
Hi, All,

When docx4j load a word file that size more than 50M, it will corrupt ,throws an OutOfMemory Error.

I debug and find that the JAXB RI 's performance is not very good, Could I replace JAXB RI to other implementation?

if yes how to replace,thanks in advance.

Re: Could replace JAXB RI to other implementation?

PostPosted: Sun Nov 13, 2011 10:42 am
by jason
50MB is a large Word file. How much of that is text, versus images?

It would be an interesting exercise to try a different implementation. Shouldn't be difficult. Off the top of my head: If you are using Java 5, put the replacement implementation on your classpath (removing JAXB). With Java 6 or later, put it in your endorsed dir.

You will also need to change org.docx4j.jaxb.NamespacePrefixMapperUtils which assumes Sun/Oracle implementation, for example, with MOXy, see http://stackoverflow.com/questions/4873 ... es-in-jaxb

Given that trunk currently uses a dependency which is yet to be put in Maven Central, and that VERSION_2_7_1 has http://www.docx4java.org/trac/docx4j/changeset/1707 I'd suggest you consider checking that version out instead for now.

An idea I am toying with for handling very large files is to shred them into eXist XML database, and then use docx4j to do its thing against eXist. Exploring this approach would be a more significant undertaking.

Please let us know what you discover!

Re: Could replace JAXB RI to other implementation?

PostPosted: Tue May 22, 2012 12:34 pm
by jason