Web Service Datasource main report + sub report + one sevice call

0

Hi,

I am getting this exception when i try to run a report containg a subreport

net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ((com.jaspersoft.webservice.data.query.IWSDataSource)$P{REPORT_DATA_SOURCE}).clone("employee(id =="+$F{id}+")", $P{SubFieldsMap})
    at com.jaspersoft.studio.editor.preview.view.control.ReportController.fillReport(ReportController.java:596)
    at com.jaspersoft.studio.editor.preview.view.control.ReportController.access$20(ReportController.java:571)
    at com.jaspersoft.studio.editor.preview.view.control.ReportController$5.run(ReportController.java:449)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ((com.jaspersoft.webservice.data.query.IWSDataSource)$P{REPORT_DATA_SOURCE}).clone("employee(id =="+$F{id}+")", $P{SubFieldsMap})
    at net.sf.jasperreports.engine.fill.JREvaluator.handleEvaluationException(JREvaluator.java:287)
    at net.sf.jasperreports.compilers.GroovyEvaluator.handleEvaluationException(GroovyEvaluator.java:98)
    at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:319)
    at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:616)
    at net.sf.jasperreports.engine.fill.JRCalculator.evaluate(JRCalculator.java:584)
    at net.sf.jasperreports.engine.fill.JRFillElement.evaluateExpression(JRFillElement.java:1164)
    at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluateSubreport(JRFillSubreport.java:463)
    at net.sf.jasperreports.engine.fill.JRFillSubreport.evaluate(JRFillSubreport.java:354)
    at net.sf.jasperreports.engine.fill.JRFillElementContainer.evaluate(JRFillElementContainer.java:383)
    at net.sf.jasperreports.engine.fill.JRFillBand.evaluate(JRFillBand.java:506)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2412)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:761)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:240)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:99)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:607)
    at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:123)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'net.sf.jasperreports.engine.fill.SortedDataSource@19b04952' with class 'net.sf.jasperreports.engine.fill.SortedDataSource' to class 'com.jaspersoft.webservice.data.query.IWSDataSource'
    at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnSAM(DefaultTypeTransformation.java:405)
    at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnNumber(DefaultTypeTransformation.java:319)
    at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:232)
    at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:603)
    at employee_list_009_1527852523107_550766.evaluate(calculator_employee_list_009_1527852523107_550766:210)
    at net.sf.jasperreports.engine.fill.JREvaluator.evaluate(JREvaluator.java:305)
    ... 14 more

 

the source of main report

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.4.3.final using JasperReports Library version 6.4.3  -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="employee_list_009" language="groovy" pageWidth="842" pageHeight="595" orientation="Landscape" columnWidth="802" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="bddf4b77-0b5d-42ee-9071-e44225accaa3">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="ISM.xml"/>
    <property name="com.jaspersoft.studio.report.description" value=""/>
    <property name="ireport.jasperserver.url" value="http://localhost:8080/jasperserver/"/>
    <property name="ireport.jasperserver.user" value="jasperadmin"/>
    <property name="ireport.jasperserver.reportUnit" value="/reports/ISM/employee_list_006"/>
    <property name="net.sf.jasperreports.data.adapter" value="ISM.xml"/>
    <property name="ireport.jasperserver.report.resource" value="/reports/ISM/employee_list_006_files/main_jrxml"/>
    <parameter name="url" class="java.lang.String"/>
    <parameter name="company" class="java.lang.String"/>
    <parameter name="token" class="java.lang.String"/>
    <parameter name="reportid" class="java.lang.String"/>
    <parameter name="SubFieldsMap" class="java.util.Map">
        <defaultValueExpression><![CDATA[["company":"company.shortname","project":"project.name","site":"employee.occuancies.project.site.name"]]]></defaultValueExpression>
    </parameter>
    <queryString language="WebServiceQuery">
        <![CDATA[{
  "getparameters" : { },
  "fields" : [ {
    "name" : "id",
    "expression" : "employee.id"
  }, {
    "name" : "name",
    "expression" : "employee.name"
  }, {
    "name" : "lastname",
    "expression" : "employee.lastname"
  } ],
  "options" : {
    "contentType" : "application/json",
    "rootPath" : "",
    "baseUrl" : "dev.api.ismvuzem.si/rpt/20e3a564-f6d5-4936-8499-9698db5a1479/employees/listhome"
  },
  "headersMap" : {
    "reportid" : "$P{reportid}"
  },
  "queryData" : "",
  "GETParameters" : { }
}]]>
    </queryString>
    <field name="id" class="java.lang.String"/>
    <field name="name" class="java.lang.String"/>
    <field name="lastname" class="java.lang.String"/>
    <sortField name="lastname"/>
    <columnHeader>
        <band height="22">
            <property name="com.jaspersoft.studio.unit.height" value="mm"/>
        </band>
    </columnHeader>
    <detail>
        <band height="101" splitType="Stretch">
            <textField isBlankWhenNull="true">
                <reportElement x="0" y="17" width="82" height="14" uuid="9788dc79-4fa7-4bde-b438-6f1fa1893879">
                    <property name="com.jaspersoft.studio.unit.height" value="mm"/>
                    <property name="com.jaspersoft.studio.unit.leftIndent" value="mm"/>
                </reportElement>
                <box>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <textElement verticalAlignment="Middle">
                    <font fontName="DejaVu Sans"/>
                    <paragraph leftIndent="2"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{lastname}]]></textFieldExpression>
            </textField>
            <textField isBlankWhenNull="true">
                <reportElement x="82" y="17" width="80" height="14" uuid="d4a1c69f-4925-4115-b2ae-55eeb842d64f">
                    <property name="com.jaspersoft.studio.unit.height" value="mm"/>
                    <property name="com.jaspersoft.studio.unit.leftIndent" value="mm"/>
                </reportElement>
                <box>
                    <leftPen lineWidth="0.25"/>
                    <bottomPen lineWidth="0.25"/>
                    <rightPen lineWidth="0.25"/>
                </box>
                <textElement verticalAlignment="Middle">
                    <font fontName="DejaVu Sans"/>
                    <paragraph leftIndent="2"/>
                </textElement>
                <textFieldExpression><![CDATA[$F{name}]]></textFieldExpression>
            </textField>
            <staticText>
                <reportElement mode="Opaque" x="162" y="0" width="640" height="17" backcolor="#E8E6E6" uuid="d24e1122-31aa-4a6a-a7a8-6d7e251fe990">
                    <property name="com.jaspersoft.studio.unit.height" value="mm"/>
                    <property name="com.jaspersoft.studio.unit.leftIndent" value="mm"/>
                </reportElement>
                <box>
                    <topPen lineWidth="0.75"/>
                    <leftPen lineWidth="0.75"/>
                    <bottomPen lineWidth="0.75"/>
                    <rightPen lineWidth="0.75"/>
                </box>
                <textElement verticalAlignment="Middle">
                    <font fontName="DejaVu Sans"/>
                    <paragraph leftIndent="2"/>
                </textElement>
                <text><![CDATA[]]></text>
            </staticText>
            <staticText>
                <reportElement mode="Opaque" x="0" y="0" width="82" height="17" backcolor="#E8E6E6" uuid="ff3d52ee-1943-4561-983b-43b075d542cb">
                    <property name="com.jaspersoft.studio.unit.height" value="mm"/>
                    <property name="com.jaspersoft.studio.unit.leftIndent" value="mm"/>
                </reportElement>
                <box>
                    <topPen lineWidth="0.75"/>
                    <leftPen lineWidth="0.75"/>
                    <bottomPen lineWidth="0.75"/>
                    <rightPen lineWidth="0.75"/>
                </box>
                <textElement verticalAlignment="Middle">
                    <font fontName="DejaVu Sans"/>
                    <paragraph leftIndent="2"/>
                </textElement>
                <text><![CDATA[Priimek]]></text>
            </staticText>
            <staticText>
                <reportElement mode="Opaque" x="82" y="0" width="80" height="17" backcolor="#E8E6E6" uuid="2e9d4089-77b3-404d-bf56-282e83a6a17a">
                    <property name="com.jaspersoft.studio.unit.height" value="mm"/>
                    <property name="com.jaspersoft.studio.unit.leftIndent" value="mm"/>
                </reportElement>
                <box>
                    <topPen lineWidth="0.75"/>
                    <leftPen lineWidth="0.75"/>
                    <bottomPen lineWidth="0.75"/>
                    <rightPen lineWidth="0.75"/>
                </box>
                <textElement verticalAlignment="Middle">
                    <font fontName="DejaVu Sans"/>
                    <paragraph leftIndent="2"/>
                </textElement>
                <text><![CDATA[Ime]]></text>
            </staticText>
            <subreport>
                <reportElement x="0" y="38" width="490" height="42" uuid="78d11903-1892-4db7-99d2-e07829149104"/>
                <parametersMapExpression><![CDATA[$P{REPORT_PARAMETERS_MAP}]]></parametersMapExpression>
                <subreportParameter name="id">
                    <subreportParameterExpression><![CDATA[$F{id}]]></subreportParameterExpression>
                </subreportParameter>
                <dataSourceExpression><![CDATA[((com.jaspersoft.webservice.data.query.IWSDataSource)$P{REPORT_DATA_SOURCE}).clone("employee(id =="+$F{id}+")", $P{SubFieldsMap})]]></dataSourceExpression>
                <subreportExpression><![CDATA["empl/employee_list_009_sub_1.jasper"]]></subreportExpression>
            </subreport>
        </band>
    </detail>
</jasperReport>

the source of the subreport

<?xml version="1.0" encoding="UTF-8"?>
<!-- Created with Jaspersoft Studio version 6.4.3.final using JasperReports Library version 6.4.3  -->
<jasperReport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="employee_list_009_sub_1" pageWidth="595" pageHeight="842" columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="2547a737-aea4-4f3b-b4e8-84fb7325aa5e">
    <property name="com.jaspersoft.studio.data.defaultdataadapter" value="One Empty Record"/>
    <parameter name="id" class="java.lang.String"/>
    <queryString language="WebServiceQuery">
        <![CDATA[{
  "getparameters" : { },
  "fields" : [ {
    "name" : "company",
    "expression" : "company.shortname"
  }, {
    "name" : "project",
    "expression" : "project.name"
  } ],
  "options" : {
    "contentType" : "application/json",
    "rootPath" : "employee(id == $P{id}).occupancies",
    "baseUrl" : "dev.api.ismvuzem.si/rpt/20e3a564-f6d5-4936-8499-9698db5a1479/employees/listhome"
  },
  "headersMap" : { },
  "queryData" : "",
  "GETParameters" : { }
}]]>
    </queryString>
    <field name="company" class="java.lang.String"/>
    <field name="project" class="java.lang.String"/>
    <background>
        <band splitType="Stretch"/>
    </background>
    <columnHeader>
        <band height="34">
            <staticText>
                <reportElement x="0" y="0" width="185" height="30" uuid="2902af56-6049-4ebc-bf25-8d9f4d6f4679">
                    <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="ebd27f34-fa5b-4d79-aca2-d205d6a0b090"/>
                </reportElement>
                <text><![CDATA[company]]></text>
            </staticText>
            <staticText>
                <reportElement x="185" y="0" width="185" height="30" uuid="1ea0e641-8853-4873-bdaa-aec6ebb857ff">
                    <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="1db2e868-9605-4715-99bc-d07d2774368c"/>
                </reportElement>
                <text><![CDATA[project]]></text>
            </staticText>
        </band>
    </columnHeader>
    <detail>
        <band height="33" splitType="Stretch">
            <textField>
                <reportElement x="0" y="0" width="185" height="30" uuid="37ec138b-de4b-4409-9848-6a0d04c0bf91">
                    <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="ebd27f34-fa5b-4d79-aca2-d205d6a0b090"/>
                </reportElement>
                <textFieldExpression><![CDATA[$F{company}]]></textFieldExpression>
            </textField>
            <textField>
                <reportElement x="185" y="0" width="185" height="30" uuid="ee11f71b-7c5b-43b6-b97d-6182fbc31147">
                    <property name="com.jaspersoft.studio.spreadsheet.connectionID" value="1db2e868-9605-4715-99bc-d07d2774368c"/>
                </reportElement>
                <textFieldExpression><![CDATA[$F{project}]]></textFieldExpression>
            </textField>
        </band>
    </detail>
</jasperReport>

what am i doing wrong? Can somebody help me?

slavkor's picture
Joined: Aug 2 2017 - 4:20am
Last seen: 1 month 2 weeks ago

Did you find what causing this.

kothany - 11 months 6 days ago

1 Answer:

0

Hi, I have the same problem., but using a table.

Hi have made another report and everything is working, then I made a new report and get this error

net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.fill.JRExpressionEvalException: Error evaluating expression for source text: ((com.jaspersoft.webservice.data.query.IWSDataSource)$P{REPORT_DATA_SOURCE}).clone("", $P{SubFieldsMap})


I don't know why this error is happened.

Could you solve this problem?

 

 

anibal.duardo's picture
Joined: Mar 27 2013 - 9:21am
Last seen: 1 month 3 days ago
Feedback