PDA

View Full Version : Jasper Reports Thread Interruption


bhaarathm
Sep 30th, 2004, 12:31 AM
Hi,
I have a problem relate to jasper report, i have tried some solutions but i 'm still not solve this problem.
It's a web application, i used Jboss 3.2.3, tomcat 5.0 integrate in jboss. In EJBs, first i call to DAO layer to get datasource, parameters.
then i call to jasper report function: JasperFillManager.fillReportToStream(jasperreport, outputstream, parameters, datasource),
If the data source is small, the method call is ok. But with huge datasource, i am seeing this problem of Thread Interruption.
"The report filling thread was interrupted"!!!
---------------------------------------------------------------------------------------
I just do not understand why the Thread was interrupted and by whom…” is it by the container “ . To give you more context, the jasper code was invoked within a stateless session bean and that bean has transaction timout set to 600. Does the Container managed transaction timeout has anything to do with this Thread Interruption ? . My initial guess is not...maybe i might be wrong.
-----------------------------------------------------------------------------------------
I open source code code of jasper report, i I that the thread generate report was interrupted at statement:
"if (Thread.currentThread().isInterrupted())
{
throw new JRException("Current thread interrupted.");
}
"
Have you had experience with this problem? Could you share with me? Why we have to check the thread by statements: "Thread.currentThread().isInterrupted()"?

Pls see the printstackstrace for details.

19:58:20,311 ERROR [STDERR] dori.jasper.engine.JRException: The report filling t
hread was interrupted.
19:58:20,311 ERROR [STDERR] at dori.jasper.engine.fill.JRFiller.fillReport(J
RFiller.java:163)
19:58:20,311 ERROR [STDERR] at dori.jasper.engine.JasperFillManager.fillRepo
rt(JasperFillManager.java:350)
19:58:20,311 ERROR [STDERR] at dori.jasper.engine.JasperFillManager.fillRepo
rtToFile(JasperFillManager.java:271)
19:58:20,311 ERROR [STDERR] at dori.jasper.engine.JasperFillManager.fillRepo
rtToFile(JasperFillManager.java:257)
19:58:20,311 ERROR [STDERR] at com.dlv.inmpp.system.ReportManager.generateRe
port(ReportManager.java:56)
19:58:20,311 ERROR [STDERR] at com.dlv.inmpp.online.ejb.rpt.RAEJB.ra002a(RAE
JB.java:3453)
19:58:20,311 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(
Native Method)
19:58:20,311 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(N
ativeMethodAccessorImpl.java:39)
19:58:20,311 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invo
ke(DelegatingMethodAccessorImpl.java:25)
19:58:20,311 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:3
24)
19:58:20,311 ERROR [STDERR] at org.jboss.ejb.StatelessSessionContainer$Conta
inerInterceptor.invoke(Stateles...

robh
Sep 30th, 2004, 12:45 PM
I would guess that the thread is being interrupted by JBoss given that the EJB specification explicitly states that an EJB can't spawn its own threads, which is effectively happening here when using JasperReports.

Try testing the code outside of an EJB, perhaps in a servlet, to see if you get the same error.

You should consider moving this out of an EJB since I don't think you can guarantee how this will run in any container. I am sure some containers will fare better than others, but the fact is containers are working to a spec that is forbidding EJBs from creating threads.

Rob

bhaarathm
Sep 30th, 2004, 04:29 PM
Thanks for the reply and actually i have a basic question.

Does this following method in Jasper actually create a new thread ?

JasperFillManager.fillReportToStream(jasperreport, outputstream, parameters, datasource),

ElPapa
Oct 2nd, 2004, 09:41 PM
I think that's what robh was saying... ;)

robh
Oct 5th, 2004, 01:03 PM
Actually, I am not entirely sure what it does. I know there is some thread signalling going on, but I haven't looked in detail to see what is happening. I suggest posting this on the JR mailing list.

Rob