6 Replies Latest reply on Nov 24, 2011 9:43 AM by tophebboy

    Seam Report Jasper and subreports

    tophebboy

      Hello everybody,


      I'm integrating Jasper to a Seam based application using SEAM Reports.
      Basically, if I have no subreport in my report design, it works well (after hours struggling).


      But now, I'm trying to integrate all my subreports, and I have errors like:




      net.sf.jasperreports.engine.JRException: Could not load object from location : usecase_desc.jasper





      I tried putting all the files in the same folder, I tried putting directly the jasper files in the web-inf folder, I still have this problem.


      If it can help, for now, I get an inputstream from my entry point jrxml file and I compile it. Then I fill the report.


      Can anybody help me?


      Thanks very much !

        • 1. Re: Seam Report Jasper and subreports
          tophebboy

          I also tried to set the SUBREPORTDIR value to the folder name where are my reports in the WEB-INF folder, and, even if the stack trace is a bit different, I still have the same issue:

          net.sf.jasperreports.engine.JRException: Could not load object from location : jasperreports/usecase
          desc.jasper



          • 2. Re: Seam Report Jasper and subreports
            gastaldi

            Try to place then under WEB-INF/classes (on src/main/resources if you're In maven). If still doesn't work, please file a JIRA issue and I'll happy to check it when possible.


            Regards


            George Gastaldi


            Seam Reports module leader

            • 3. Re: Seam Report Jasper and subreports
              tophebboy

              Thx. Gonna try this right now.

              • 4. Re: Seam Report Jasper and subreports
                tophebboy

                OK. I added the jrxml in the folder and it didn't work.
                So I added the .jasper too and it worked.
                I don't understand where the jrxml files are compiled. The best solution would be to embbed only the .jasper files but it doesn't work for me.


                When I use:



                 JasperPrint fillReport = JasperFillManager.fillReport(report,parameters, connection);





                starting from an InputStream on the jasper file, it doesn't work. I don't understand why: i have standard logs without any error and then at some point:



                13:45:08,890 INFO  [org.jboss.resource.connectionmanager.CachedConnectionManager] Closing a connection for you.  Please close them yourself: org.jboss.resource.adapter.jdbc.jdk6.WrappedConnectionJDK6@5fe54e64: java.lang.Throwable: STACKTRACE





                Anyway, using the jrxml as the entry point (which is working using a report without any subreport), the first subreport is found, but at some point, I have an error I really don't understand (especially knowing that launching this report from iReport works perfectly): at some point I have a NullPointerException at net.sf.jasperreports.engine.fill.JRFillTextField.setTemplatePattern(JRFillTextField.java:324)


                Setting a breakpoint on NPE's, I succeeded into isolating this: the NPE seems to occur in JRCalculator, at line 580, in evaluateEstimated(JRExpression expression). The expression parameter as null as its value class and this causes the NPE to be thrown. I don't understand why ...


                Any idea???

                • 5. Re: Seam Report Jasper and subreports
                  tophebboy

                  It seems that for some reason, one of the variables which is perfectly working with iReport doesn't work here.
                  This is a variable which is used to build a table of content.
                  Its name is MASTERPAGENUMBER
                  and its expression is:
                  $P{PARENT_PAGE}+$V{PAGE_NUMBER}-1
                  The paramater PARENTPAGE is well evaluated, PAGENUMBER too.
                  I tried changing it to:
                  ($P{PARENT_PAGE}.intValue()+$V{PAGE_NUMBER}.intValue())-1
                  then to
                  ($P{PARENT_PAGE}.intValue()+$V{PAGE_NUMBER}.intValue())
                  Nothing works, I still have null as expression value for this one :-/

                  • 6. Re: Seam Report Jasper and subreports
                    tophebboy

                    OK. I finally found why I had so many issues: seam reports is based upon jasper reports 4.0.1 and I designed my reports with iReport 4.1.1 based on jasper reports 4.1.1. It seems that the 4.1.1 version is more flexible, and when I downloaded iReport 4.0.1 and tried to compile my reports with it, I was able to find some errors solve them.
                    Now, even loading directly the .jasper works :D
                    Thanks for the help !!!