Altiy Zemlytskiy
Altiy Zemlytskiy

Reputation: 61

Jasperreport problem wtih subreport using javaflow

I have a problem with subreport using javaflow with Jasperreport 6.7.0 according to The Definitive Guide to JasperReports – Teodor Danciu, Lucian Chirita, page 130. I need it to avoid different threads call when the report is calling in our application because of valuable reasons.

There is the setting at default.jasperreport.properties

net.sf.jasperreports.subreport.runner.factory=net.sf.jasperreports.engine.fill.JRContinuationSubreportRunnerFactory

And when I run a my report with more then 5 rows got an error:

java.lang.IllegalStateException: Stack corruption on suspend (empty stack). Is net.sf.jasperreports.engine.fill.JRContinuationSubreportRunner@2024896527/org.apache.catalina.loader.WebappClassLoader@1847497893 instrumented for javaflow? at org.apache.commons.javaflow.core.StackRecorder.execute(StackRecorder.java:131) at org.apache.commons.javaflow.api.Continuation$MultiShotContinuation.resumeWith(Continuation.java:521) at org.apache.commons.javaflow.api.Continuation.resume(Continuation.java:314) at org.apache.commons.javaflow.api.Continuation.startWith(Continuation.java:219) at org.apache.commons.javaflow.api.Continuation.startWith(Continuation.java:169) at org.apache.commons.javaflow.api.Continuation.startWith(Continuation.java:148) at net.sf.jasperreports.engine.fill.JRContinuationSubreportRunner.start(JRContinuationSubreportRunner.java:53) at net.sf.jasperreports.engine.fill.JRFillSubreport.prepare(JRFillSubreport.java:931) at net.sf.jasperreports.components.table.fill.FillTableSubreport.prepareSubreport(FillTableSubreport.java:175) at net.sf.jasperreports.components.table.fill.FillTable.prepare(FillTable.java:424) at net.sf.jasperreports.engine.fill.JRFillComponentElement.prepare(JRFillComponentElement.java:152) 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.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2585) 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.BaseReportFiller.fill(BaseReportFiller.java:413) at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:120) at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:103) at org.wgsoftpro.reposerver.SetReport.fillReport(SetReport.java:469) at org.wgsoftpro.reposerver.SetReport.runReport(SetReport.java:190) at org.wgsoftpro.reposerver.CreateReport.run(CreateReport.java:454) at org.apache.catalina.core.AsyncContextImpl$RunnableWrapper.run(AsyncContextImpl.java:557) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) at java.lang.Thread.run(Thread.java:748)

If there are less rows report is running without problem.

I have dependency at pom.xml to get org.apache.commons.javaflow.api

<dependency>
    <groupId>net.tascalate.javaflow</groupId>
    <artifactId>net.tascalate.javaflow.api</artifactId>
    <version>2.4.0</version>
</dependency>

Any suggetion will be estimated.

UPDATE: I got the same error with net.tascalate.javaflow.api version 2.2.1

UPDATE 2: I found out that if we make the pageHeight bigger and all data fit to one page, everything works. So the problem is connected to second page initializing

<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="vetmed" language="javascript" pageWidth="595" ***pageHeight="1500"*** columnWidth="555" leftMargin="20" rightMargin="20" topMargin="20" bottomMargin="20" uuid="c2935bae-a905-4770-8aca-21bb3b76afde">

Upvotes: 2

Views: 1405

Answers (2)

dada67
dada67

Reputation: 5103

The vanilla JasperReports jar (as published on Maven) is not instrumented for JavaFlow.

There's a variant of the jar that can be downloaded from SourceForge, see jasperreports-javaflow-6.7.0.jar

But that jar is not published on Maven, so you'll need to find a way to use it in your build. See this answer for some ways to do that.

Upvotes: 2

Valery Silaev
Valery Silaev

Reputation: 319

Disclosure: I'm a maintainer of Tascalate JavaFlow library. It looks like you didn't instrument necessary continuable classes during build.

Tascalate Javaflow provides both Ant task and Maven plugin, I'm not sure what works best with Jasper Reports, but you have either: -- include Maven build plugin as descibed here. -- setup Ant as with this example.

Or probably you have a mix of continuable / non-continuable methods on calls chain.

Also, according to info on Maven Central Jasper Reports 6.7 uses Tascalate JavaFlow 2.2.1 -- it's a bad idea to create a versioning hell with adding higher version (2.4.0)

Upvotes: 0

Related Questions