7

What is the usage of jasperreports-javaflow?

I referred the below two links, Am not clear. could you elaborate!

http://community.jaspersoft.com/questions/541789/jasperreports-versus-jasperreports-javaflow-libraries-thread-issue

http://community.jaspersoft.com/questions/529333/jasperreports-javaflow-versus-jasperreports

Alex K
  • 22,315
  • 19
  • 108
  • 236
Karups
  • 187
  • 1
  • 2
  • 11

1 Answers1

11

jasperreports-javaflow is a variant of the standard JasperReports jar that can be used in environments where spawning new Java threads is prohibited. That was the case, for instance, with EJB containers some years ago (don't know if it's still the case). But in most cases the standard JasperReports jar is fine and you don't need to worry about jasperreports-javaflow.

JasperReports creates threads (by default) to render subreports (and table elements) because page/column breaks require the the subreport generation to stop at some point in the call stack and then resume on the new page/column. Commons Javaflow continuations provide a mechanism to do that without threads, and the jasperreports-javaflow jar has classes instrumented for Javaflow continuations. Also see the JasperReports subreport sample documentation.

To use the continuations subreport runner, you need to include the jasperreports-javaflow jar on the classpath (instead of the regular jasperreports jar, you shouldn't have both) along with a Commons Javaflow jar (for instance the one at http://jaspersoft.jfrog.io/jaspersoft/third-party-ce-artifacts/org/apache/commons/commons-javaflow/20160505/) and to set the following property in jasperreports.properties:

net.sf.jasperreports.subreport.runner.factory=net.sf.jasperreports.engine.fill.JRContinuationSubreportRunnerFactory

Update: Starting with version 6.6.0, JasperReports uses tascalate-javaflow instead of Apache Commons Javaflow (for Java 8 support). Therefore instead of a Commons Javaflow jar you'll need to have a net.tascalate.javaflow.api jar on the classpath (such as net.tascalate.javaflow.api-2.2.1.jar).

dada67
  • 4,723
  • 17
  • 19
  • We're using a java web application which is deployed in tomcat 7. I'm able to create report by using jasper-reports jar 6_3_0 alone. If I've added jasperreport-javaflow, I'm not seeing any difference. So in my environment it is safe to say I'm not needing the javaflow jars right ? How to test whether I'm needing the javaflow jar or not ? – Karups Nov 11 '16 at 11:27
  • You don't need jasperreports-javaflow. You could test a report with a subreport or a table element if you want to be sure, but I don't see why it wouldn't work. – dada67 Nov 11 '16 at 13:28
  • See this for further details: https://web.archive.org/web/20090420131026/http://curiouscreature.net/blog/2008/07/29/running-jasperreports-with-subreports-in-an-app-server-environment/ – Kamal Nov 08 '17 at 14:45