繁体   English   中英

Jasper Reports:子报告导致无限循环

[英]Jasper Reports : sub-reports are causing an infinite loop

我的应用程序中有多个Jasper Reports (包含子报告)。 出于某种原因,一份报告(也包含子报告)不再起作用。 调试超过1天后,我发现它进入无限循环并继续创建用于子报告填充的线程。

调试器保持循环:

JRSubReportRunnable.java

public void run()
{
    running = true;     
    error = null;

    try
    {
        fillSubreport.fillSubreport();
    }
    catch (JRFillInterruptedException e)
    {
        //If the subreport filler was interrupted, we should remain silent
    }
    // we have to catch Throwable, because it is difficult to say what would happen with the master
    // filler thread in case we don't
    catch (Throwable t) //NOPMD
    {
        error = t;
    }

    running = false;
}

上面的方法启动一个Thread以填充子报告。 完成后,设置running = false并且调试器将:

JRThreadSubreportRunner.java

public void run()
{
    super.run();

    if (log.isDebugEnabled())
    {
        log.debug("Fill " + subreportFiller.fillerId + ": notifying of completion");
    }

    synchronized (subreportFiller)
    {
        //main filler notified that the subreport has finished
        subreportFiller.notifyAll();
    }
}

一旦线程完成,它就会转到上面的方法subreportFiller.notifyAll(); 线。 然后,调试器返回到JRSubreportRunnable.java ,依此类推。

从理论上讲,如果我有5个子报告,它应该创建5个线程(适用于其他报告)。 不幸的是,对于这种情况,它不断创建线程,我的调试器在上面提到的两种方法之间“卡住”(仅供参考:类来自jasperreports-3.7.6-sources.jar )。

还尝试过:

我发现了一个类似的StackOverflow问题 ,但是那里提出的答案对我没有用。 在JasperSoft社区中此线程中没有提出任何建议的解决方案。

我真的无法理解为什么会出现这个问题。 我确信这是一个很小的东西,因为它曾经工作过。 希望其他人偶然发现这个并且可能有解决方案。 提前感谢您的回答。 (我知道我没有提供关于我的子报告内容的真正信息,但它非常隐私;不过,我可以向你保证报告的内容和相关的子报告没有改变 - 用Git检查)

我有完全相同的问题,并通过将我的子报告的isPrintWhenDetailOverflows属性从true更改为false来解决它,如下所示: http//community.jaspersoft.com/questions/527078/infinite-loop-subreport-fill

希望能帮助到你

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM