Free Support Forum -

ClassCastException on Form Fill

Hi! We are currently evaluating the Aspose.Pdf.Kit for our java application, and so far it looks really good. It’s the first framework that does not skew/move filled form elements on flatten.

However, when we tried to deploy this in our web application we get a ClassCastException:

2008-06-13 10:23:49,232 ERROR SocketListener0-6
httpParametersProcess] Exception in PDF merge!<o:p></o:p>


java.lang.ClassCastException: org.apache.xerces.parsers.SAXParser cannot be cast to com.aspose.sax.XMLReader

at com.aspose.sax.helpers.XMLReaderFactory.createXMLReader(Unknown Source)

at com.aspose.xmlparser.tree.XmlDocument.createXmlDocument(Unknown Source)

at com.aspose.xmlparser.tree.XmlDocument.createXmlDocument(Unknown Source)

at Source)

at Source)

at Source)

at com.aspose.pdf.kit.b8.else(Unknown Source)

at com.aspose.pdf.kit.Form.(Unknown Source)

at com.skagenfondene.common.util.PDFUtils.merge(

at com.skagenfondene.k3s.corelets.tabs.TransDrawTab.pdfMerger(

at com.skagenfondene.k3s.corelets.tabs.TransDrawTab.postSaveTransactions(

at com.skagenfondene.k3s.corelets.tabs.TransactionTab.process(

at com.skagenfondene.k3s.corelets.tabs.TransDrawTab.process(

at com.corelets.util.components.Component.process(



at com.corelets.util.components.Component.process(

at com.skagenfondene.k3s.corelets.K3SMainCorelet.process(

at com.corelets.servlets.helpers.CoreletLifecycle.invokeProcess(

at com.corelets.servlets.helpers.RequestAndResponse.process(

at com.corelets.servlets.Renderer.process(

at com.corelets.servlets.CCS_Servlet.invokeProcessWithContext(

at com.corelets.servlets.CCS_MasterServlet.process(

at com.corelets.servlets.CCS_Servlet.service(

at javax.servlet.http.HttpServlet.service(

at org.mortbay.jetty.servlet.ServletHolder.handle(

at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(


at org.springframework.web.filter.OncePerRequestFilter.doFilter(

at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(

at com.skagenfondene.filters.GZIPFilter.doFilter(

at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(

at com.skagenfondene.filters.AddSynchronizeTokenFilter.doFilter(

at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(

at org.mortbay.jetty.servlet.WebApplicationHandler.dispatch(

at org.mortbay.jetty.servlet.ServletHandler.handle(

at org.mortbay.http.HttpContext.handle(

at org.mortbay.jetty.servlet.WebApplicationContext.handle(

at org.mortbay.http.HttpContext.handle(

at org.mortbay.http.HttpServer.service(

at org.mortbay.http.HttpConnection.service(

at org.mortbay.http.HttpConnection.handleNext(

at org.mortbay.http.HttpConnection.handle(

at org.mortbay.http.SocketListener.handleConnection(

at org.mortbay.util.ThreadedServer.handle(

at org.mortbay.util.ThreadPool$

Obviously there seems to be a conflict between the apache SAXParser and your XMLReader. Is there a way around this?

The code where the exception is thrown is:

Form form = new Form(inputFile.getPath(), outputFile.getPath());

where inputFile and outputFile are normal objects.

Egil Sørensen

Dear egil,

Thanks for considering Aspose.Pdf.Kit for Java.

If not violating your privacy, would you please provide the resouces to reproduce the problem? The related source code is also expected.

Thanks & Best regards.

I’m sorry to say that I can’t provide the entire web application. I’ll attach the PDFUtils class that I’m working on. The libraries that it seems to be in conflict with are:

The application is run on a CMS system called CorePortal with Spring/Hibernate in bottom of it.

When I run the example from Eclipse it works like a charm, but it is first when we build it and run it from the web container we get the exception.

Dear egil,

It's a pitty that the problem cannot be reproduced. We will discuss and analyze it ASAP from the Exception information and those two libraries mentioned above.

Best regards.

Hi Egil,

We made a fix in the light of the exception information since we could not reproduce the error. Please try the attachment (aspose.pdf.kit.jar v2.0.0.2) and tell us whether it works in your application or not.



Thank you very much, the patched version worked like a charm in my application!

We’ll go straight to testing it further in our environment, it seems to be just the library we need.

Thanks again for great help!
Egil Sørensen