LaVOZs

The World’s Largest Online Community for Developers

'; java - Jasper reports: getting errors of class not found - LavOzs.Com

i'm trying to print my report but its not coming in jrviewer. this is exception which i'm getting

Exception in thread "main" java.lang.NullPointerException at net.sf.jasperreports.engine.fill.JRFillImage.evaluateImage(JRFillImage.java:1034) at net.sf.jasperreports.engine.fill.JRFillImage.evaluate(JRFillImage.java:1004) at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:258) at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:499) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillTitle(JRVerticalFiller.java:326) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:262) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:128) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:946) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:845) at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:247) at Reports.ReportView.(ReportView.java:36) at Main.main(Main.java:27)

This is my code: {

public class ReportView extends JFrame
{
    public ReportView(String fileName) throws Exception
    {
        this(fileName, null);
    }
    public ReportView(String fileName, HashMap para) throws Exception
    {
        super("ABC Solutions Employee/Project Management System (Report Viewer)");
        DBhandler db = new DBhandler();
        Connection con = db.getconnection();
        try
        {
            JasperPrint print = JasperFillManager.fillReport(fileName, para, con);
            JRViewer viewer = new JRViewer(print);
            Container c = getContentPane();
            c.add(viewer);            
        } 
        catch (JRException jRException)
        {

        }
        setBounds(10, 10, 1500, 1500);
        setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    }

}
}

Don't pass nulls. If you don't have any parameters, instantiate your parameter HashMap before passing it to Jasper. Even if it is empty:

   public ReportView(String fileName) throws Exception
   {
        this(fileName, new HashMap< String, String >() );
   }

In Jasper-report server you cant pass "null" values in graph category column.

Related
How do I test a private function or a class that has private methods, fields or inner classes?
JasperReports NoClassDefFoundError exception on net.sf.jasperreports.engine.util.JRStyledTextParser
iReport font not available to JVM net.sf.jasperreports.awt.ignore.missing.font=true has no effect.
Jasper sub report error
Jasper reports List as Parameter
JasperReport: How to get date from the "oracle.sql.TIMESTAMP' field?
Barcode creation in Jasper report: n is not a valid character for Standard 2 of 5 encoding
Call Jasper subreports in java