0
votes

Good afternoon. I am working on JDK 1.6.

I am trying to integrate JasperReports to the Java Web Application of company where I work. First, I created an simple Java Application for to test the reports generation, and I used the next libraries (jars):

  • Commons collections 3.2.1
  • Commons beanutils 1.9.0
  • Commons digester 2.1
  • Commons logging 1.2
  • Groovy all 1.8.0
  • Joda time 2.0
  • JasperReports 6.0.0

With these I was able to create a report but, when I transfered this libraries to the Java Web Application,happened the next exception:

javax.faces.FacesException: #{bean.functionCalled}: java.lang.reflect.InvocationTargetException
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
    at org.primefaces.application.CleanupActionListener.processAction(CleanupActionListener.java:42)
    ...
Caused by: javax.faces.el.EvaluationException: java.lang.reflect.InvocationTargetException
    at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:102)
    at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
    ... 51 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    ... 52 more
Caused by: java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/util/JRLoader
    ... 85 more
Caused by: java.lang.ClassNotFoundException: net.sf.jasperreports.engine.util.JRLoader
    at java.net.URLClassLoader$1.run(Unknown Source)
    ...
    ... 86 more

I found out that the cause of the problem is the commons loggin version, or the libraries combination. By default, this Java Web Application has the next libraries:

  • Commons collections 3.2
  • Commons beanutils 1.6
  • Commons digester 1.8.1
  • Commons logging 1.1.1
  • Groovy all 1.5.4
  • Joda time 1.6

I'm making differents versions combinations but not working, the problem persist.

What you recommend me?

Thank you so much.

1

1 Answers

0
votes

This is a missing jars in the class path issue.

I had this issue and found that with by adding the missing jars to the class path it resolved the issue.

From the below article java.dzone.com article here I found that the minimal jars necessary are...Now The versions numbers have changed but with these libraries only I managed to get it working.

  1. jasperreports-3.5.3.jar and above version
  2. commons-digester-2.1.jar
  3. commons-collections-3.2.jar (commons-collections.jar)
  4. commons-logging-1.2.jar
  5. commons-beanutils.jar
  6. iText-5.0.jar (used infor PDF exporting)