Rau*_*ene 5 java jasper-reports
我的应用程序中有多个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;
}
Run Code Online (Sandbox Code Playgroud)
上面的方法启动一个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();
}
}
Run Code Online (Sandbox Code Playgroud)
一旦线程完成,它就会到达上面的方法subreportFiller.notifyAll();
行.然后,调试器返回到JRSubreportRunnable.java,依此类推.
从理论上讲,如果我有5个子报告,它应该创建5个线程(适用于其他报告).不幸的是,对于这种情况,它不断创建线程,我的调试器在上面提到的两种方法之间"卡住"(仅供参考:类来自jasperreports-3.7.6-sources.jar).
还尝试过:
我发现了一个类似的StackOverflow问题,但是那里提出的答案对我没有用.在JasperSoft社区中,此线程中没有提出任何建议的解决方案.
我真的无法理解为什么会出现这个问题.我确信这是一个很小的东西,因为它曾经工作过.希望其他人偶然发现这个并且可能有解决方案.提前感谢您的回答.(我知道我没有提供关于我的子报告内容的真正信息,但它非常隐私;不过,我可以向你保证报告的内容和相关的子报告没有改变 - 用Git检查)
小智 6
我遇到了完全相同的问题,并通过将我的子报告的 isPrintWhenDetailOverflows 属性从 true 更改为 false 来解决它,如下所示:http : //community.jaspersoft.com/questions/527078/infinite-loop-subreport-fill
希望能帮助到你