• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

my jasper report viewer is generating blank pdf output

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I am using the below code to display the jasper report from my servlet. I am getting the blank pdf output. I have created this report using JasperStudio and able to run this report within studio. please help me.

        FileInputStream fis = new FileInputStream("D:\\Tomcat10\\webapps\\tester\\reports\\test.jasper");
        Class.forName("com.mysql.jdbc.Driver");
        Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/tester?user=test&password=test123");
        JasperReport jasperReport = (JasperReport) JRLoader.loadObject(fis);
        JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, null, connection);
        JasperViewer.viewReport(jasperPrint,false);
        fis.close();

Thanks in advance.
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems like the issue might be with the file path or the report parameters. Double-check the file path and ensure the database connection is valid. Also, try passing parameters to fillReport if required.
 
ys reddy
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks. I have checked the dbconnection and parameters. Report is working fine within jasper studio on same computer (I am using one development computer for all webserver, dbserver and jasper studio). I have added jasperreports, itext and commons jar files into lib folder and classpath.
 
Bartender
Posts: 7645
178
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't see any code that would write anything to a PDF file, or the servlet output.

As an aside, the Class.forName call hasn't been necessary for at least a decade.
 
Where does a nanny get ground to air missles? Protect this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic