Jump to content
We've recently updated our Privacy Statement, available here ×

manishamauni

Members
  • Posts

    10
  • Joined

  • Last visited

manishamauni's Achievements

Apprentice

Apprentice (3/14)

  • First Post Rare
  • Collaborator Rare
  • Conversation Starter Rare
  • Week One Done
  • One Month Later

Recent Badges

0

Reputation

  1. Sure that can be done using Ireport...but again it will not solve.. just delay the Out of memory...and thread problem...
  2. Thanks Aniruddh !! I am also trying to avoid frequent compilation of ".jrxml". I compile all the report template at the time of web application startup and store them in a bean class (ReportTemplates) . //------------------------------------------------------------------- private JasperReport loadAndCompileReport(String reportXmlFile) { logger.info("loading and compiling " + reportXmlFile + "....."); InputStream reportStream = this.getClass().getResourceAsStream(reportXmlFile); JasperReport compliedReport = null; try { JasperDesign reportDesign = JRXmlLoader.load(reportStream); reportDesign.setPageHeight(595); reportDesign.setPageWidth(842); reportDesign.setOrientation(JRReport.ORIENTATION_LANDSCAPE); compliedReport = JasperCompileManager.compileReport(reportDesign); } catch (Exception exp) { logger.error(exp.getMessage()); } return compliedReport; } //------------------------------------------------------------------- whenever I get a report request I get the corressponding "JasperReport" using following function... //------------------------------------------------------------------- private JasperPrint getReport(int reportId, boolean ignorePagination, String rptHeader, final List formattedData) { JasperPrint currentReport = null; Hashtable srConfigData = BootstrapServlet.getStyleReportConfigData(); int subReportId = Integer.parseInt(((ReportConfigData) srConfigData .get(reportId + "")).getSubReportId()); logger.info("sunReportId [" + reportId + "] " + subReportId); Map parameters = new HashMap(); try { //JRFileVirtualizer virtualizer = new JRFileVirtualizer(10,"marstemp"); JRGzipVirtualizer virtualizer = new JRGzipVirtualizer(10); // get the "JasperReport" from the bean ReportTemplates reportTemplates = ReportTemplates.getInstance(); JasperReport jasperReportMain = reportTemplates.getStyleMainReport(); logger.info("Subreport id for the report(" + reportId + ") - " + subReportId); JasperReport jasperReportSubreport = reportTemplates.getStyleSubReport(subReportId); parameters.put("rptHeader", rptHeader); parameters.put("ProjectDetailSubreport", jasperReportSubreport); parameters.put(JRParameter.REPORT_VIRTUALIZER, virtualizer); if (ignorePagination) { parameters.put("IS_IGNORE_PAGINATION", Boolean.TRUE); } else { parameters.put("IS_IGNORE_PAGINATION", Boolean.FALSE); } currentReport = JasperFillManager.fillReport(jasperReportMain,parameters, new JRBeanCollectionDataSource(formattedData)); //virtualizer.cleanup(); } catch (Exception exp) { logger.error(exp.getMessage()); exp.printStackTrace(); } return currentReport; } //------------------------------------------------------------------- And depending on the file format type (html/pdf/rtf/....) I pass it to the corresponding function. The function I use for pdf export is as follows... //------------------------------------------------------------------- private void downloadToPdf(HttpServletRequest request, HttpServletResponse response, final JasperPrint jasperPrint, String fileName) { try { logger.info("Downloading (pdf)- " + fileName + " for the user -" + request.getSession().getAttribute(ReportPortalconstantsIfc.USER_NAME)); response.setHeader("Content-Disposition", "attachment; filename=""+ fileName + ".pdf""); response.setContentType("application/pdf"); ByteArrayOutputStream baos = new ByteArrayOutputStream(); JRPdfExporter exporter = new JRPdfExporter(); exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint); exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos); exporter.exportReport(); byte[] content = baos.toByteArray(); response.setContentLength(content.length); response.getOutputStream().write(content); response.getOutputStream().flush(); } catch (Exception exp) { logger.error(exp.getMessage()); } } //----------------------------------------------------
  3. Hi All, I am using jasper reports for generating different reports in my web application. All my reports make use of subreports. After 40-50 min my web application starts throwing OutOfMemory. I have tried all the GC optimizations (http://java.sun.com/docs/hotspot/gc1.4.2/) without much success. On checking thread dump I found that subreport filler threads are getting locked. These locked threads are holding up the memory and gradually forcing application towards Out of memory. //--------------------------------------------------------------------------------------- "template_11 subreport filler" daemon prio=1 tid=0x0862ac88 nid=0x2813 waiting for monitor entry [0x813e9000..0x813ea228] at sun.awt.font.NativeFontWrapper.getFontMetrics(Native Method) at java.awt.Font.defaultLineMetrics(Font.java:1595) at java.awt.Font.getLineMetrics(Font.java:1662) at java.awt.font.TextMeasurer.initAll(TextMeasurer.java:223) at java.awt.font.TextMeasurer.<init>(TextMeasurer.java:149) at java.awt.font.LineBreakMeasurer.<init>(LineBreakMeasurer.java:292) at java.awt.font.LineBreakMeasurer.<init>(LineBreakMeasurer.java:259) at net.sf.jasperreports.engine.fill.TextMeasurer.renderParagraph(TextMeasurer.java:259) at net.sf.jasperreports.engine.fill.TextMeasurer.measure(TextMeasurer.java:220) at net.sf.jasperreports.engine.fill.JRFillTextElement.chopTextElement(JRFillTextElement.java:528) at net.sf.jasperreports.engine.fill.JRFillTextField.prepare(JRFillTextField.java:534) at net.sf.jasperreports.engine.fill.JRFillElementContainer.prepareElements(JRFillElementContainer.java:345) at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:311) at net.sf.jasperreports.engine.fill.JRFillBand.fill(JRFillBand.java:275) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillColumnBand(JRVerticalFiller.java:1291) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillDetail(JRVerticalFiller.java:631) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReportContent(JRVerticalFiller.java:248) at net.sf.jasperreports.engine.fill.JRVerticalFiller.fillReport(JRVerticalFiller.java:132) - locked <0x8a315458> (a net.sf.jasperreports.engine.fill.JRVerticalFiller) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:758) at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:685) at net.sf.jasperreports.engine.fill.JRFillSubreport.fillSubreport(JRFillSubreport.java:498) at net.sf.jasperreports.engine.fill.JRSubreportRunnable.run(JRSubreportRunnable.java:63) at net.sf.jasperreports.engine.fill.JRThreadSubreportRunner.run(JRThreadSubreportRunner.java:137) at java.lang.Thread.run(Thread.java:534) //--------------------------------------------------------------------------------------- Are there any specific things we need to keep in mind while using sureports? I saw one at http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=&func=view&catid=8&id=3709#3709 However my reports don’t have that issue. Would appreciate any help in resolving this issue. I am running the web server on Linux and I am using - j2sdk1.4.2_12 - jasperreports-1.2.5 - Apache Tomcat 5.0.28 Thanks Manisha
  4. I have already tried increasing heap , running parallel GC, enabling perm GC...... it delays outofmemory by 5-10 min and nothing much.
  5. Hi All, I am using jasper reports for creating around 14 different reports in my web application. Report size varies from 1 page to 1000 pages. By the time I use only html formt .... things are good. However when i start exporting reports to pdf/rtf/xls it gradually starts clogging up memory and at last starts throwing OutOfMemory. My web application - uses Tomcat 5.5 - All the reports make use of subreports. I have tried virtualizer but it doesn’t make much difference. Are there any other options that I should be looking into?? Would appreciate any help...... Thanks Manisha
  6. Hi All, I am using jasper reports for creating around 14 different reports in my web application. Report size varies from 1 page to 1000 pages. By the time I use only html formt .... things are good. However when i start exporting reports to pdf/rtf/xls it gradually starts clogging up memory and at last starts throwing OutOfMemory. My web application - uses Tomcat 5.5 - All the reports make use of subreports. I have tried virtualizer but it doesn’t make much difference. Are there any other options that I should be looking into?? Would appreciate any help...... Thanks Manisha
  7. Hi All, I am using conditional styles in my reports. Till now I am specifying them in my jrxml using "<conditionalStyle>" and it works great. //------------------------ <style name="rowStyle" isDefault="true"> <conditionalStyle> <conditionExpression><![CDATA[new Boolean($F{lineType}.equalsIgnoreCase("REPORT_HEADER_01") )]]></conditionExpression> <style isDefault="false" forecolor="#000080" hAlign="Left" vAlign="Bottom" fontName="Times New Roman" fontSize="18" isBold="true" isItalic="true" pdfFontName="Helvetica" /> </conditionalStyle> <conditionalStyle> <conditionExpression><![CDATA[new Boolean($F{lineType}.equalsIgnoreCase("SECTION_BREAK_01") )]]></conditionExpression> <style isDefault="false" forecolor="black" hAlign="Left" vAlign="Top" fontName="Times New Roman" fontSize="11" isBold="true" isItalic="false" pdfFontName="Helvetica" /> </conditionalStyle> </style> //------------------------------- Now I have to read the style attributes for each condition from a property file and overwrite the one in jrxml(default one) using jasper API. Overwriting normal styles i.e. JRStyle seems to be straight forward. Some how I am not able to figure out a way to overwrite the conditional styles. Will appreciate any help / pointers on it ...... Thanks Manisha
  8. Thanks Teodor!! Appreciate your help. Post edited by: manishamauni, at: 2006/10/16 16:04
  9. Hello, I am using same JasperPrint instance for creating my report in html format and pdf format using JasperExportManager.exportReportToHtmlFile(jasperPrint, "test/MainReport.html" ); and JasperExportManager.exportReportToPdfFile(jasperPrint, "test/MainReport.pdf") functions respectively. I can print my html report both in portrait and landscape orientation while I am not able to do so for pdf report. I tried setting JRReport.ORIENTATION_LANDSCAPE but it’s just ignoring the setting. I want to give user flexibility of printing pdf report in portrait as well as landscape…. Please help….. Thanks Manisha
×
×
  • Create New...