Subreport returns a NullPointerException, but runs standalone.

0

Hi guys,

I am using the WebServiceQuery to query a Rest service that returns an array, I output this on a report. This works fine.
Now I want to embed this report as subreport on another report, but I suddenly get an NPE. 

I am using JasperSoft Studio 6.6.0.

This is the frame that needs to display the subreport:

            <frame>
                <reportElement positionType="Float" mode="Transparent" x="0" y="0" width="560" height="215" isRemoveLineWhenBlank="true" forecolor="#9EC536" backcolor="#9EC536" uuid="be586fc9-f669-4c1f-a1d9-b6c0af9329fa">
                    <property name="com.jaspersoft.studio.unit.height" value="pixel"/>
                </reportElement>
                <subreport>
                    <reportElement x="1" y="0" width="555" height="200" uuid="88025de9-5c1b-4451-83b0-3fa1f8f6cc9f"/>
                    <subreportParameter name="verbKey">
                        <subreportParameterExpression><![CDATA[$P{verbKey}]]></subreportParameterExpression>
                    </subreportParameter>
                    <subreportParameter name="test">
                        <subreportParameterExpression><![CDATA["test"]]></subreportParameterExpression>
                    </subreportParameter>
                    <connectionExpression><![CDATA[$P{REPORT_CONNECTION}]]></connectionExpression>
                    <subreportExpression><![CDATA["AttachmentSubreport.jasper"]]></subreportExpression>
                </subreport>
            </frame>


I get the following error: 

net.sf.jasperreports.engine.JRException: net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Error creating request: java.lang.NullPointerException
    at com.jaspersoft.studio.editor.preview.view.control.ReportController.fillReport(ReportController.java:536)
    at com.jaspersoft.studio.editor.preview.view.control.ReportController.access$17(ReportController.java:511)
    at com.jaspersoft.studio.editor.preview.view.control.ReportController$1.run(ReportController.java:429)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
Caused by: net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: Error creating request: java.lang.NullPointerException
    at net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java:956)
    at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:542)
    at net.sf.jasperreports.engine.fill.JRFillFrame.prepare(JRFillFrame.java:241)
    at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:542)
    at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:453)
    at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:428)
    at net.sf.jasperreports.engine.fill.JRFillBand.refill(JRFillBand.java:400)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2642)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:813)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:264)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:110)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:615)
    at net.sf.jasperreports.engine.fill.BaseFillHandle$ReportFill.run(BaseFillHandle.java:135)
    at java.lang.Thread.run(Thread.java:748)
Caused by: net.sf.jasperreports.engine.JRException: Error creating request: java.lang.NullPointerException
    at com.jaspersoft.webservice.data.util.WebServiceConnector.createRequestForWs(WebServiceConnector.java:187)
    at com.jaspersoft.webservice.data.util.WebServiceConnector.callWS(WebServiceConnector.java:134)
    at com.jaspersoft.webservice.data.query.WebServiceQueryExecuter.createDatasource(WebServiceQueryExecuter.java:168)
    at com.jaspersoft.webservice.data.query.WebServiceQueryExecuter.createDatasource(WebServiceQueryExecuter.java:1)
    at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:1257)
    at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:726)
    at net.sf.jasperreports.engine.fill.BaseReportFiller.setParameters(BaseReportFiller.java:456)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:578)
    at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java:413)
    at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:814)
    at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:61)
    at net.sf.jasperreports.engine.fill.AbstractThreadSubreportRunner.run(AbstractThreadSubreportRunner.java:221)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    ... 1 more
Caused by: java.lang.NullPointerException
    at com.jaspersoft.webservice.data.util.WebServiceConnector.getRequestUrl(WebServiceConnector.java:199)
    at com.jaspersoft.webservice.data.util.WebServiceConnector.createGetRequest(WebServiceConnector.java:236)
    at com.jaspersoft.webservice.data.util.WebServiceConnector.createRequestForWs(WebServiceConnector.java:173)
    ... 14 more


Any help is much appreciated, thanks! 

Cheers,

Richard

richard.olrichs's picture
Joined: Oct 10 2018 - 3:40am
Last seen: 7 months 3 weeks ago

Apparently you need to pass a parameter map, for now I am just passing:

<parametersMapExpression><![CDATA[$P{REPORT_PARAMETERS_MAP}]]></parametersMapExpression>

This gets rid of the NPE at least. 

richard.olrichs - 10 months 2 weeks ago

I had a very similar problem, but with 6.2.1, I fixed updating to 6.4.1 

firuzzz - 7 months 2 weeks ago

0 Answers:

No answers yet
Feedback