NPE when added a second subreport

By: JC Tchitchiama - jeanch
NPE when added a second subreport
2002-10-01 02:50
Hi,

I am a jasper newbie so please be kind to me if my question is trivial or indeed has already been answered.
First of all congratulations for Jasper tool I think it's great and one can get a report together in no time at all.

Here is my query:
I have just appended a subreport to the MasterReport example and that works fine. Now I am adding a second report containing a picture and I get the following NPE

[java] java.lang.NullPointerException
[java] at dori.jasper.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:338)
[java] at dori.jasper.engine.fill.JRFillSubreport.run(JRFillSubreport.java:369)
[java] at java.lang.Thread.run(Thread.java:484)

Here is how the subreport is defined in the Master.xml
<subreport isUsingCache="true">
<reportElement x="5" y="25" width="500" height="20" backcolor="#FFFFDD"/>
<subreportParameter name="City"> <subreportParameterExpression>
$F{City} </subreportParameterExpression>
</subreportParameter>
<connectionExpression>
$P{REPORT_CONNECTION}
</connectionExpression>
<subreportExpression class="dori.jasper.engine.JasperReport">
"NewReport.jasper"
</subreportExpression>
</subreport>

Cheers
JC


By: Teodor Danciu - teodord
RE: NPE when added a second subreport
2002-10-01 02:56

Hi,

The "class" attribute of your
<subreportExpression> element should not be
"dori.jasper.engine.JasperReport", because you are
not supplying an in-memory report object,
but rather try to load it from disk.

This attribute should be "java.lang.String",
I suppose.

Read the "Quick Reference".

I hope this helps.
Teodor



By: JC Tchitchiama - jeanch
RE: NPE when added a second subreport
2002-10-01 08:20
Got it !!
when adding a subreport one must supply either a connectionExpression or a DataSource. Note that an empty data source is OK too when you don't have a data source per say.

Cheers
JC
2001 JI Open Discussion's picture
Joined: Aug 10 2006 - 3:26am
Last seen: 17 years 1 month ago

0 Answers:

No answers yet
Feedback
randomness