I have this json DS:
{
"customername":"home",
"workSiteRows":[
{
"invoiceRows":[
{
"candidateName":"name1",
"units":"13:00"
},
{
"candidateName":"name2",
"units":"18:30"
}
],
"workSiteName":"wsname1"
},
{
"invoiceRows":[
{
"candidateName":"name1",
"units":"13:00"
},
{
"candidateName":"name2",
"units":"18:30"
}
],
"workSiteName":"wsname2"
}
]
}
In my .jrxml file I have defined a subreport and I'm trying to create a subDataSource to pass to this subreport.
<subreport isUsingCache="false">
<reportElement x="0" y="10" width="555" height="30" uuid="b2d96c34-ad5d-4eb2-b218-43aad4e09282" />
<dataSourceExpression><![CDATA[((net.sf.jasperreports.engine.data.JsonDataSource)$P{REPORT_DATA_SOURCE}).dataSource("workSiteRows")]]></dataSourceExpression>
<subreportExpression><![CDATA[$P{REPORT_DIR} + "\\invoice_ws_row.jasper"]]></subreportExpression>
</subreport>
I keep getting the following exception: Error filling print...
java.lang.NoClassDefFoundError: org/codehaus/jackson/JsonNode java.lang.ClassNotFoundException: org.codehaus.jackson.JsonNode
I tried using the answer from question http://community.jaspersoft.com/questions/956036/caused-javalangclassnotfoundexception-orgcodehausjacksonjsonnode-exception-ireport
But it does not work.
The problem is that currently jackson core is under the repo "com.fasterxml.jackson.core"
while iReport keeps asking for "org.codehaus.jackson.core"
.
Tried looking for older versions of jackson core that are under org.codehaus and to add them to the iReport classpath but it still does not work. Any ideas ?
Normally you dont need to cast the expression.
Try: <![CDATA[$P{REPORT_DATA_SOURCE}.subDataSource("workSiteRows")]]>
This works just fine in my case. In your case the subDataSource is an array, maybe you could also give it a try and use an object.