Hi:
While issuing a PDF generation from a XSL and XML pair on Oracle 10G server,
we are getting PermGen error [OutOfMemory]. Same code works Ok on Tomcat as
well as Sun App server. Can anybody throw some light what could be the
workaround? Need help.
Our XSL transformation code (writeReport method that takes three parameters:
names for xml data file, XSL file and PDF file) is as given below.
warm regards,
Debasish Jana
-----
public boolean writeReport (String xmlFile, String xsltFile, String
pdfFile)
{
try
{
OutputStream out = new FileOutputStream (pdfFile);
out = new java.io.BufferedOutputStream (out);
try
{
FopFactory fopFactory = FopFactory.newInstance ();
FOUserAgent foUserAgent = fopFactory.newFOUserAgent ();
// Construct fop with desired output format
Fop fop = fopFactory.newFop (MimeConstants.MIME_PDF,
foUserAgent, out);
// Setup XSLT
System.setProperty ("javax.xml.transform.TransformerFactory",
"org.apache.xalan.processor.TransformerFactoryImpl") ;
TransformerFactory factory = TransformerFactory.newInstance();
Transformer transformer = factory.newTransformer (new
StreamSource (new File (xsltFile))) ;
// Set the value of a <param> in the stylesheet
transformer.setParameter ("versionParam", "2.0");
// Setup input for XSLT transformation
Source src = new StreamSource (new File (xmlFile)) ;
// Resulting SAX events (the generated FO) must be piped
through to FOP
Result res = new SAXResult (fop.getDefaultHandler ());
// Start XSLT transformation and FOP processing
transformer.transform (src, res);
}
catch (Exception e)
{
return (false) ;
}
catch (Error e)
{
return (false) ;
}
finally
{
out.close ();
}
}
catch (Exception e)
{
return (false) ;
}
return (true) ;
}