docx4j Integrating


Hi There,

I am working on writing an extension that lets you edit MailMerge fields from Outsystems (just like Aspose for words) using docx4j. The code that I wrote worked fine on my local machine but when I converted it to an extension, it doesn't work and I get an exception that has something to do with JBoss (according to forums on StackOverflow). I was wondering if anyone else has worked with docx4j before and can help me in writing this extension.



And the error that I get is in the attached PDF

HI Gurvinder,

The problem is that jboss already includes many libraries by default and you can't add them in your extension with a deploy action set to "Copy to binaries directory" or they will conflict with them (most of the times even if the version is the same as the ones shipped with jboss).

You will need to set the ones that conflict set to "ignore" and hope the version on jboss works with your project.

I'm pretty sure that the error you getting if because of the xalan lib, but I also warn you that at least commons-io and sl4fj can cause you issues since they will also be duplicated and with different versions.

João Rosado

Hi João,

I tried removing reference to xalan lib but that didn't work either. I got the following exception: org.apache.xml.serializer.ToXMLSAXHandler cannot be cast to org.apache.xml.serializer.SerializationHandler