xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benoit, Frederick C." <FREDERICK.C.BEN...@saic.com>
Subject Embedding FOP in .NET throwing logging error
Date Thu, 21 Oct 2010 20:23:17 GMT
I am using FOP 1.0 in an ASP.NET application.  When I try to instantiate
a FopFactory object as FopFactory fopFactory = FopFactory.newInstance(),
I get the following runtime error:

 

{"org.apache.commons.logging.LogConfigurationException:
java.lang.ExceptionInInitializerError (Caused by
java.lang.ExceptionInInitializerError) (Caused by
org.apache.commons.logging.LogConfigurationException:
java.lang.ExceptionInInitializerError (Caused by
java.lang.ExceptionInInitializerError))"}

 

Stack trace:

 

at SLPPMIS.Reports.Business.PdfRender.Render(Page page, DataSet ds,
String xsltFilename, String reportName, XsltArgumentList xsltArgs) in
C:\\dev\\CodeDev\\src\\reports\\Business\\PdfRender.cs:line 226\r\n   

at SLPPMIS.Reports.Business.ReportRender.Render(DataSet ds, String xslt,
XsltArgumentList args, String reportName) in
C:\\dev\\CodeDev\\src\\reports\\Business\\ReportRender.cs:line 89\r\n   

at GratisWeb.Report.ReportViewer.Page_Load(Object sender, EventArgs e)
in C:\\dev\\CodeDev\\src\\GratisWeb\\report\\ReportViewer.aspx.cs:line
202\r\n   

at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object
o, Object t, EventArgs e)\r\n   

at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object
sender, EventArgs e)\r\n   

at System.Web.UI.Control.OnLoad(EventArgs e)\r\n   

at System.Web.UI.Control.LoadRecursive()\r\n   

at System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 

 

My method is as follows:

 

        public void Render(Page page, DataSet ds, string xsltFilename,
string reportName, XsltArgumentList xsltArgs)

        {

 
java.lang.System.setProperty("javax.xml.transform.TransformerFactory",

                "org.apache.xalan.processor.TransformerFactoryImpl");

                     

 
java.lang.System.setProperty("javax.xml.parsers.SAXParserFactory",

                "org.apache.xerces.jaxp.SAXParserFactoryImpl");

                     

            java.lang.System.setProperty("org.xml.sax.driver",

                "org.apache.xerces.jaxp.SAXParserFactoryImpl");

 

            java.io.File outputFile = new java.io.File(reportName +
".pdf");

            ByteArrayOutputStream outputStream = new
ByteArrayOutputStream();

 

            try

            {

                FopFactory fopFactory = FopFactory.newInstance();

                Fop fop = fopFactory.newFop("application/pdf",
outputStream);

 

                TransformerFactory transformerFactory =
TransformerFactory.newInstance();

                Transformer transformer =
transformerFactory.newTransformer(new
StreamSource(page.Server.MapPath(string.Format("~/xslt/{0}.fo.xslt",
xsltFilename))));

 

                Source sourceObj = new
StreamSource(ds.GetXml().Replace("\n", "<br/>"));

                Result resultObj = new
SAXResult(fop.getDefaultHandler());

 

                transformer.transform(sourceObj, resultObj);

            }

            catch(Exception ex)

  {

    throw new InvalidOperationException("Failed to render PDF", ex);

  }

       }

 

How do I properly set a logging provider?

 

Regards,

 

Clay Benoit 



 


Mime
View raw message