• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Casting exception-Cannot cast xxx with string to yyyy

 
sinsand singh
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am currently getting a casting exception,
Cannot cast object 'net.sf.jasperreports.engine.data.JRMapArrayDataSource@1a63401' with class 'java.lang.String' to class 'java.util.List'

The language is groovy.
Here in this exception what does "with class 'java.lang.String' means.
What this exception is trying to say?
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15207
36
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does your code look like?
 
sinsand singh
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
my groovy code is
def rows = []
try {
rows = sql.rows(query.toString())
} catch (Exception e) {
log.error "Could not execute ${query} with params ${e.getMessage()}", e.printStackTrace()
}
new JRMapArrayDataSource(rows)

I am getting the data in rows as arraylist.
After that I am putting the data in parameter
like
params.putAt("subReportData",new JRMapArrayDataSource(positionService.getpositionResultsForInner(params)))

and in jrxml i have put
<parameter name="subReportData" class="net.sf.jasperreports.engine.data.JRMapArrayDataSource" isForPrompting="false"/>

Any idea how to pass any datasource to jasper in groovy, i have worked in java and done similar thing with JRMapCollectionDataSource and that was working
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic