Free Support Forum -

java.lang.ClassCastException while executing How-to: Mail Merge from XML using IMailMergeDataSource

Hi there,

I'm trying to replicate an example from "How-to: Mail Merge from XML using IMailMergeDataSource" doc and here:

DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();

I'm getting this:

at javax.xml.parsers.DocumentBuilderFactory.newInstance(Unknown Source)
at xxProgram.xxmain(xxProgram:22)

the classes I've created are in attach, java 1.4.2, aspose words 10.3

Any thoughts?


Hi there,

Thanks for your inquiry.

Normally such an error means you have more than one version of that class visible to your application. Please ensure only one version of the JDK is being used and only the required libraries are referenced in your application.

Is there a stack trace with more information available on your end? If so, please post it here for us.


…or no class visible at all?

Hi there,

Thanks for this additional information.

Well, I would assume if the class was not visible then you would get a compile error. Please ensure that the appropriate JARs are in your classpath. From memory I think javax.xml.parsers only requires rt.jar but I may be wrong.


thanks mate, I’ll have a look