niobe Posted April 13, 2007 Share Posted April 13, 2007 Hi, I have a problem with regard to creating a dynamic PDF file from a JRXML in a specific environment. Following is my code and an explanation of the problem I am facing. The report generation works on my local computer, on the development environment however fails to work on the QA environment of our application. Any help would be appreciated. Code: Code:System.out.println("Before fill Report"«»);JasperPrint printerObject = JasperFillManager.fillReport(srcFile, reportParameters, conn); if (TASK_PDF.equals(reportFormat)) { System.out.println("In the PDF if condition"«»); JRPdfExporter exporter = new JRPdfExporter(); System.out.println("Created Pdf Exporter"«»); exporter.setParameter(JRExporterParameter.JASPER_PRINT, printerObject); exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, destFile); exporter.exportReport(); System.out.println("Exported"«»); System.out.println("PDF creation time : " + (System.currentTimeMillis() - start)); return true; } The problem that I am facing is that the PDF file fails to generate. All the debugging statements in the if condition fail to print as well. Thus only the "Before fill Report" prints out... which means that I fail at the fillReport call itself. When I look at the logs, I see no sign of any exception being thrown. So I dont know exactly what fails and where it fails. What's more confusing is that the code that calls this method prints out all its debugging statements as though nothing happened. Any ideas as to why it would work in both Windows and one Linux box but not on another similar Linux box? And why does the call to fillReport not generate any errors if they are taking place? Thanks!Post edited by: niobe, at: 2007/04/12 17:50 Link to comment Share on other sites More sharing options...
acer Posted April 13, 2007 Share Posted April 13, 2007 JasperPrint printerObject = JasperFillManager.fillReport(srcFile, reportParameters, conn);System.out.println("Report Filled!!!! "); System.out,println("if condition will return "+TASK_PDF.equals(reportFormat)); if (TASK_PDF.equals(reportFormat)) { My 2 cents: add a new debug message as above. this will confirms if fillReport bombs out. if the culprit is not fillReport (An assumption that can be made as you dont see a stack trace) is if (TASK_PDF.equals(reportFormat)) Link to comment Share on other sites More sharing options...
edikk Posted April 13, 2007 Share Posted April 13, 2007 Try to run with java parameters:java -Djava.awt.headless=true ... Link to comment Share on other sites More sharing options...
niobe Posted April 13, 2007 Author Share Posted April 13, 2007 thanks for your reply guys... regarding debugging statements.. i'd already tried extensive debugging.. and i know that the problem is fillReport (not the if condition) even though it doesn't display a stack trace. Any ideas on that? As for the environments my code works in: Works in Windows and GNU/Linux 2.6.9-22.20.ELsmp Does NOT work in GNU/Linux 2.4.21-32.0.1.Elsmp Why would that be? Link to comment Share on other sites More sharing options...
niobe Posted April 14, 2007 Author Share Posted April 14, 2007 It worked! the -Djava.awt.headless=true option worked. Thanks a lot for that..! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now