2

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.

olivmir
  • 692
  • 10
  • 29
  • 1
    Do you actually need javaflow? See https://stackoverflow.com/a/40545982/983559 If you do need it, what JasperReports version are you using? – dada67 Jun 06 '18 at 07:58
  • @dada67 yes, very good hint - I've removed javaflow from my classpath, and now it works! Thank you! Only one remark concerning your answer http://stackoverflow.com/a/40545982/983559: the Commons Javaflow jar does not contain `org.apache.commons.javaflow.core.StackRecorder`- I therefore searched and found https://github.com/vsilaev/tascalate-javaflow - this contains it. Adding it to the classpath also fixes this exception! But the solution, not adding javaflow at all, for sure is much more better! – olivmir Jun 06 '18 at 08:14
  • You're right, I updated the answer at https://stackoverflow.com/a/40545982/983559 to talk about the switch to tascalate-javaflow. I'll post an answer to this question as well for better visibility. – dada67 Jun 06 '18 at 08:44

1 Answers1

4

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.

dada67
  • 4,723
  • 17
  • 19