jasper-reportsireport

Jasper Report subreport issue


I have a master report which contains a lot of information and I need to add a Sub-Report. When I run JUnit Test of Master Report, an exception is thrown:

net.sf.jasperreports.engine.JRRuntimeException: net.sf.jasperreports.engine.JRException: The subreport is placed on a non-splitting band, but it does not have a rewindable data source.
    at net.sf.jasperreports.components.table.fill.FillTable.rewind(FillTable.java:392)
    at net.sf.jasperreports.engine.fill.JRFillComponentElement.rewind(JRFillComponentElement.java:171)
    at net.sf.jasperreports.engine.fill.JRFillElementContainer.rewind(JRFillElementContainer.java:651)
    at net.sf.jasperreports.engine.fill.JRFillBand.refill(JRFillBand.java:355)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:2044)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:760)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportStart(JRVerticalFiller.java:270)
    at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:128)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:946)
    at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:864)
    at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:84)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:624)
    at ar.com.qyttrade.jasperreports.ExtraMainReportTest.extraReportTest(ExtraMainReportTest.java:95)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
    at org.junit.runners.BlockJUnit4ClassRunner.runNotIgnored(BlockJUnit4ClassRunner.java:79)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:71)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:49)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: net.sf.jasperreports.engine.JRException: The subreport is placed on a non-splitting band, but it does not have a rewindable data source.
    at net.sf.jasperreports.engine.fill.JRFillSubreport.rewind(JRFillSubreport.java:782)
    at net.sf.jasperreports.components.table.fill.FillTable.rewind(FillTable.java:388)
    ... 35 more

I don't know what is the purpose of this error. I tried every combination with "Split type" and "Split Allowed" at Detail Band, but it does not work. I need to know why this error is done. Another issue is in the sub-report I have a table with it own Data Source, how set the parameters to Master Report and how the sub report should load this Data Source?


Solution

  • This is only happen when you Placed your subreport on Title band or Page Header band. So Place your sub report except above band because this bands are non looping bands.