Search code examples
javajasper-reportsapache-commons

ClassNotFoundException: org.apache.commons.javaflow.core.StackRecorder


When filling my Jasper Report I get the following exception:

java.lang.ClassNotFoundException: org.apache.commons.javaflow.core.StackRecorder
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1285)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1119)
    at net.sf.jasperreports.engine.fill.BaseReportFiller.fill(BaseReportFiller.java)
    at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:162)
    at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:145)
    at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:689)
    at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:670)
    at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:992)

I've already added commons-javaflow (https://search.maven.org/#search%7Cga%7C1%7Ca%3A%22commons-javaflow%22) - but this does not help. Where to find this class?

EDIT: one comment to the duplicate question tag: this is not a general question about ClassNotFoundException - this is a special question concerning Jasper-Reports / Apache Commons JavaFlow. So please take away this tag.


Solution

  • Starting with JasperReports 6.6.0, tascalate-javaflow is used instead of Apache Commons Javaflow, so you'll need a net.tascalate.javaflow.api jar on the classpath (at the current moment, JasperReports lists net.tascalate.javaflow.api-2.2.1.jar as a dependency).

    But the first thing that you need to do is to decide whether you actually need the Javaflow JasperReports variant. See this answer for a description on when the Javaflow variant is meant to be used.