I have ReportDataSourceServiceImpl class which defines datasource by commandName. The method data.get() returns data for datasouce. public class ReportDataSourceServiceImpl implements ReportDataSourceService { private String commandName; @Override public void setReportParameterValues(@SuppressWarnings("rawtypes") Map parameterValues) { JRDataSource ds; switch (commandName) { case "first": ds = new FirstDataSource(data.get(url, auth, parameterValues)); break; case "second": ds = new SecondDataSource(data.get(url, auth, parameterValues)); break; default: ds = new FirstDataSource(data.get(url, auth, parameterValues)); } parameterValues.put(JRParameter.REPORT_DATA_SOURCE, ds); }}[/code]To define some parameters for the data.get() method I added these parameters to reportUnit with "Add Input control..." on JasperReport page. This works fine but now I want to create a report with a subreport. I have created two data sources and report unit in the repository at the JasperServer. I put main.jrxml and "first" data source into the report unit. I pass "((net.sf.jasperreports.engine.data.JRDataSource) $P{REPORT_DATA_SOURCE}).dataSource("/reports/Tests/second")" into Data Source Expression field. After running the report I have an error: Errors were encountered when compiling report expressions class file: 1. net.sf.jasperreports.engine.data.JRDataSource cannot be resolved to a type value = ((net.sf.jasperreports.engine.data.JRDataSource) //$JR_EXPR_ID=9$ <-------------------------------------------> 2. net.sf.jasperreports.engine.data.JRDataSource cannot be resolved to a type value = ((net.sf.jasperreports.engine.data.JRDataSource) //$JR_EXPR_ID=9$ <-------------------------------------------> 3. net.sf.jasperreports.engine.data.JRDataSource cannot be resolved to a type value = ((net.sf.jasperreports.engine.data.JRDataSource) //$JR_EXPR_ID=9$ <-------------------------------------------> 3 errors .[/code]What is the right way to create a report with a subreport?