Jump to content
We've recently updated our Privacy Statement, available here ×

Casting exception-Cannot cast xxx with string to yyyy


sinsand

Recommended Posts

hi below is the error, i am getting wne i am trying to pass a datasource to jasper from groovy

Cannot cast object 'net.sf.jasperreports.engine.data.JRMapCollectionDataSource@9fa028' with class 'java.lang.String' to class 'net.sf.jasperreports.engine.data.JRMapCollectionDataSource'.

My groovy code is

List ls = new ArrayList();
            Map mp = new HashMap();
            mp.put("aa","a");
            mp.put("bb","xx");
            mp.put("cc",20.0);
            mp.put("dd",2.0);
            mp.put("ee",1.5);
            ls.add(mp);

params.putAt("subReportData",new JRMapCollectionDataSource(ls))

My Main report.jrxml

I am having it as a parameter

<parameter name="subReportData" class="net.sf.jasperreports.engine.data.JRMapCollectionDataSource">

and passing this as a dataSourceExpression to the subreport

Can any one suggests whats wrong?

i have done this with java and that was working fine.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...