This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Casting exception-Cannot cast xxx with string to yyyy

 
sinsand singh
Greenhorn
Posts: 8
  • 0
  • 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
Pie
Posts: 15150
31
Android IntelliJ IDE Java Scala Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does your code look like?
 
sinsand singh
Greenhorn
Posts: 8
  • 0
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic