Jump to content
Changes to the Jaspersoft community edition download ×

Failure to create PDF in certain environment


Recommended Posts



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.





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);
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?





Post edited by: niobe, at: 2007/04/12 17:50

Link to comment
Share on other sites

  • Replies 4
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...