6 Replies Latest reply: Feb 25, 2013 8:47 PM by dvohra21 RSS

    Error in when run Jasper Reports

    Padma
      Hi All,

      I'm trying to run a jasper report using jdeveloper 11.1.0.2
      I created a jsf page and added following code in my backing bean. I added jasper related jar files to viewController, but when I run the application it gives the following error

      BackingBean code :
      Map parameters = new HashMap();
      parameters.put(0, new Integer(0));
      ArrayList<String> list = new ArrayList<String>();
      try{
      String UserName = "Jasper";
      File inFileName = new File("applications/Reports/" + "MemberDetails" + ".jasper");
      System.out.println("path "+inFileName.getParentFile());
      File outPutPDF = new File("applications/Reports/" + "MemberDetails");
      // File outPutRTF = new File ("applications/reports/output/"+UserName+”_temp.rtf”);
      JasperPrint jasperPrint;

      jasperPrint = JasperFillManager.fillReport(inFileName.getPath(), parameters, new JRBeanCollectionDataSource(list));
      JasperExportManager.exportReportToPdfFile(jasperPrint, outPutPDF.getPath());
      }
      catch (JRException e) {
      }



      Error message

      javax.faces.el.EvaluationException: //C:/Users/padmakumarav/AppData/Roaming/JDeveloper/system11.1.2.0.38.60.17/o.j2ee/drs/ReportModule/ViewControllerWebApp.war/pages/DerivativeBill.jsf @8,103 action="#{backingBeanScope.backing_DerivativeBill.GenerateReport}": java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/data/JRBeanCollectionDataSource
           at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51)
           at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
           at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
           at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:787)
           at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1252)
           Truncated. see log file for complete stacktrace
      Caused By: java.lang.NoClassDefFoundError: net/sf/jasperreports/engine/data/JRBeanCollectionDataSource
           at view.TradeReports.backing.DerivativeBill.GenerateReport(DerivativeBill.java:31)
           at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
           at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
           at java.lang.reflect.Method.invoke(Method.java:597)
           Truncated. see log file for complete stacktrace

      Please any body help me to resolve this problem

      Thanks
      Padma
        • 1. Re: Error in when run Jasper Reports
          dvohra21
          Is the jasperreports-4.7.0.jar in the runtime classpath of the server?

          Add the Jasper Reports required JAR files to the \\user_projects\domains\base_domain\bin\startWebLogic.bat script’s CLASSPATH variable.
          • 2. Re: Error in when run Jasper Reports
            993272
            Hi,

            can you check if u had jar twice in classpath


            Thanks,
            Naresh
            • 3. Re: Error in when run Jasper Reports
              Padma
              Hi

              Thanks for the information

              I didn't add jasper jar files to the class path, just added them in ViewControllers as a library, Isn't this enough. more I'm using jasperreports-3.0.1
              • 4. Re: Error in when run Jasper Reports
                dvohra21
                Jasper JAR files in the WEB-INF/lib should get added to classpath, but because of a bug in WebLogic Server, the WEB-INF/lib packaged JARs don't get added to the runtime classpath.

                Add to the startWebLogic script CLASSPATH variable.
                • 5. Re: Error in when run Jasper Reports
                  Padma
                  Hi,

                  I added those libraries to WEB-INF/lib folder and set CLASSPATH also.
                  when I run run the application libraries in WEB-INF/lib will automatically deleted and following error message occured

                  Caused By: java.lang.ClassNotFoundException: net.sf.jasperreports.engine.JRException
                       at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
                       at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
                       at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
                       at java.lang.ClassLoader.loadClass(ClassLoader.java:305)
                       at java.lang.ClassLoader.loadClass(ClassLoader.java:246)

                  what could be the reason for this.
                  Your help would be much appreciated.
                  • 6. Re: Error in when run Jasper Reports
                    dvohra21
                    java.lang.ClassNotFoundException: net.sf.jasperreports.engine.JRException

                    The JasperReports JAR files are still not found in the runtime classpath. Restart server after modifying classpath.