Exception in JasperPrint in JasperReport-Collection of common programming errors
JasperPrint is throwing a null pointer exception when i pass sql connection in its parameter but it runs fine when i pass JRResultSetDatasource.
java.lang.NullPointerException
at java.lang.Class.isAssignableFrom(Native Method)
at net.sf.jasperreports.engine.fill.JRFillTextField.getFormat(JRFillTextField.java:706)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluateText(JRFillTextField.java:394)
at net.sf.jasperreports.engine.fill.JRFillTextField.evaluate(JRFillTextField.java:368)
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.fillColumnBand(JRVerticalFiller.java:2036)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:760)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:270)
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.JRFillSubreport.fillSubreport(JRFillSubreport.java:609)
at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:59)
at net.sf.jasperreports.engine.fill.JRThreadSubreportRunner.run(JRThreadSubreportRunner.java:205)
at java.lang.Thread.run(Unknown Source)
when i pass connection in jasperPrint it gives exception.
jasperPrint = JasperFillManager.fillReport(jasperReport,
map, reportConnection);
I am also using a subreport so that is why i am not using JRResultSetDatasource and using connection. I am just stuck into this. but when i pass JRResultSetDatasource it works fine and when i also pass connection object in a hasmap parameter it gives and error. the above exception.
-
I Just Fixed it two minutes ago updating my ireport jar file to the last version
-
Your jasper-designer and jar in your project should be the same version.
-
There is no an issue to replace from old .jar to new .jar. If you have an option. Suppose you need to maintain the old jar but it should work means. Please use this.
The following code works in higher version [Ex: 4.1.1] not in older version [Ex: 3.7.6].
new net.sf.jasperreports.engine.data.JRBeanCollectionDataSource ($F{subReportBeanList})
The same code works in older version with little bit modification.