【发布时间】:2012-10-18 12:21:13
【问题描述】:
我的应用程序中有多个 Jasper 报告(带有子报告)。出于某种原因,一份报告(也包含子报告)不再起作用。调试了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;
}
上述方法启动一个线程以填充子报告。完成后,设置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)。
也试过了:
我找到了similar StackOverflow question,但那里提出的答案对我不起作用。 this thread on the JasperSoft Community 提出的任何解决方案也没有。
我真的不明白为什么会出现这个问题。我敢肯定这是一件小事,因为它曾经工作过。希望其他人偶然发现了这一点并可能有解决方案。提前感谢您的任何回答。 (我知道我没有提供关于我的子报告内容的真正信息,但它是非常私密的;不过,我可以向您保证,报告和相关子报告的内容没有改变 - 用 Git 检查)
【问题讨论】:
-
感谢您的反对。您能否发表评论,解释为什么您对帖子投了反对票?
标签: java jasper-reports