Jump to content

gkari

Members
  • Posts

    14
  • Joined

  • Last visited

gkari's Achievements

Apprentice

Apprentice (3/14)

  • Week One Done
  • One Month Later
  • One Year In
  • First Post Rare
  • Collaborator Rare

Recent Badges

0

Reputation

  1. Dear all, We've generated report templates using the I-report plugin for Netbeans and store the compiled (.jasper) files. When the application is built, these are stored under WEB-INF/classes/../templates. When accessed through the application for report generation the following exception is thrown: net.sf.jasperreports.engine.JRException: Error loading object from InputStream at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:198) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:603) at management.reports.ReportingBean.generateReport(ReportingBean.java:520) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) Caused by: java.io.UTFDataFormatException at java.io.ObjectInputStream$BlockDataInputStream.readUTFSpan(ObjectInputStream.java:3082) at java.io.ObjectInputStream$BlockDataInputStream.readUTFBody(ObjectInputStream.java:3007) at java.io.ObjectInputStream$BlockDataInputStream.readUTF(ObjectInputStream.java:2820) However, when the reports are compiled within the java application and then used (as opposed to using the already compiled reports), everything works fine. Is there a way to avoid the overhead of compiling each report before use and just using precompiled .jasper files? Any pointers would be appreciated. Thanks.
  2. Hi Lucian, Thank you for your response. This is how my code looks now: web.xml mapping <servlet> <servlet-name>image</servlet-name> <servlet-class>net.sf.jasperreports.j2ee.servlets.ImageServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>image</servlet-name> <url-pattern>/reports/image</url-pattern> </servlet-mapping> source code HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(true); Map imageMap = new HashMap(); session.setAttribute("IMAGES_MAP", imageMap); session.setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, jasperPrintObj); exporter = new JRHtmlExporter(); exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, Boolean.FALSE); exporter.setParameter(JRHtmlExporterParameter.IMAGES_MAP, imageMap); exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "/reports/image?image="); Despite these changes, the chart does not get populated. Am I missing something? Regards, GKAri
  3. Hi Lucian, These are the only steps we use: 1. Configuring the image servlet in the web.xml as follows: <servlet> <servlet-name>image</servlet-name> <servlet-class>net.sf.jasperreports.j2ee.servlets.ImageServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>image</servlet-name> <url-pattern>/reports/image</url-pattern> </servlet-mapping> 2. Setting the jasperObj against the DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE attribute as follows: HttpSession session = (HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(true); session.setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, jasperPrintObj); Am I missing something? Regards, GK
  4. Hi Lucian, No. No errors in the log file. Regards, GK
  5. Dear all, We are aware that this problem has been discussed on this forum before. However, we have not been able to find its solution despite trying every proposed solution. All other formats except HTML generate charts perfectly fine. However, the HTML report just shows up a blank image. We use JSF+Icefaces+Glassfish. This is what we have in our java file: exporter = new JRHtmlExporter(); exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, Boolean.FALSE); exporter.setParameter(JRHtmlExporterParameter.IS_WHITE_PAGE_BACKGROUND, Boolean.TRUE); exporter.setParameter(JRHtmlExporterParameter.IMAGES_URI, "../servlets/image?image="); exporter.setParameter(JRHtmlExporterParameter.IMAGES_DIR_NAME, "/<webappname>/images/"); exporter.setParameter(JRHtmlExporterParameter.IS_OUTPUT_IMAGES_TO_DIR, Boolean.TRUE); session.setAttribute(ImageServlet.DEFAULT_JASPER_PRINT_SESSION_ATTRIBUTE, jasperPrintObj); Following is the web.xml setting. <servlet> <servlet-name>image</servlet-name> <servlet-class>net.sf.jasperreports.j2ee.servlets.ImageServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>image</servlet-name> <url-pattern>/reports/image</url-pattern> </servlet-mapping> If someone can provide pointers on what we are missing here, we would appreciate that very much. Thanks, GK
  6. Hi Sanjeev, I see this is a very old post but I am facing the same problem. We use Icefaces+JSF +Glassfish. I have tried a lot of fixes but can't get th charts to show up. Could you resolve this issue. If yes, can you please provide some pointers. Thanks and Regards, GK
  7. Hey Kasi, My best suggestion to you would be to look for tutorials online. Thanks.
  8. Hi All, We are using charts. I understand the ideal way is to render the chart in the summary section (which is one single section in the report) However, if we wanted to show the chart at the begnning of the report, is it possible? Can any section of the report template other than the summary be used? Any inputs would be highly appreciated. Thanks.
  9. Thanks Lucian! I wrote my own custom sorter to order the records and it works fine. Regards, GK Ari
  10. Hi All, We use custom java objects for our reports. However, the group feature does not group them correctly. The generated report shows several small groups rather than 3 main groups.(which is expected) Can anyone confirm that the grouping feature works with custom data objects as the datasource. Thanks and Regards, GKAri
  11. Hi all, Is is possible to pass the results of a subreport to another subreport? For e.g if we want to do something like this select * from table a where trip id in (Subreport 1) (select trip id from table b where status ='Passed' ) (Sub report 2) The trip ids from table b need to be passed to sub report 1. Any guidance/pointers would be appreciated. Thanks
  12. Hi All, We want to integrate Jasper Reports into our application (JSF/Icefaces/Glassfish) We are trying to seek pointers on how the Jasper Engine would function inside of the application server. Does it get initialised/started up when the application is deployed or does it stay un-initialised until the first request for the report is made ( and is then lazily loaded). Also, once it is loaded, does it remain active or keeps getting initialised with every report request. Any pointers would be greatly appreciated. Thanks. GKAri
  13. Hi All, We are evaluating Japser Reports as a potential reporting solution for our application.(Icefaces, JSF on Glassfish) We've looked into creating templates, formatting ans exporting the report into different formats and understand that run time parameters can be passed for conditional query. for eg. <parameter name="city" class="java.lang.String"/> select customername, age, address, telno from customer where city=$p{city} Is there a way to parametrise the selecte parameters so that the user can be given the option of choosing the details he wants to view in the report? For e.g select $P!{options} from customer As far as my understanding goes, this is not possible since we have to define all the selection fields in the report template and those cannot be provided at runtime. Please correct me if I am wrong. Also, can Jasper Reports be easily integrate with JSF/Glassfish. Any pointers would be greatly appreciated.
×
×
  • Create New...