Hitachi Vantara Pentaho Community Forums
Results 1 to 4 of 4

Thread: Problems with JfreeReport using a servlet in neatbeans

  1. #1

    Default Problems with JfreeReport using a servlet in neatbeans

    Hi. I am working with a web application. I am using neatbeans 6.0 beta. I need to have a report section. I started to use jfreereport. I downloaded pentaho report designer and designed one report using mysql tables. No problem. I got reporte1.report and publish it as xml "report1.xml". Until now no problem.

    I wan to include it in my web application using servlet. I have a servlet like this:


    import java.io.IOException;
    import java.net.URL;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.ServletException;
    import javax.servlet.ServletOutputStream;

    import org.jfree.report.JFreeReportBoot;
    import org.jfree.report.JFreeReport;
    import org.jfree.report.modules.parser.base.ReportGenerator;
    import org.jfree.report.modules.output.pageable.pdf.PdfReportUtil;
    import org.jfree.resourceloader.*;

    /**
    * Processes a report.
    *
    * @author Thomas Morgner
    */
    public class informedsrx1 extends HttpServlet
    {
    public informedsrx1()
    {
    }

    public void init() throws ServletException
    {
    JFreeReportBoot.getInstance().start();
    }

    protected void doGet(final HttpServletRequest request,
    final HttpServletResponse response) throws ServletException, IOException
    {
    final String reportDefinition = request.getParameter("report-definition");
    final URL reportUrl = getServletContext().getResource(reportDefinition);
    if (reportUrl == null)
    {
    response.sendError(HttpServletResponse.SC_BAD_REQUEST);
    return;
    }

    try
    {
    final JFreeReport report = ReportGenerator.getInstance().parseReport(reportUrl);
    response.setContentType("application/pdf");

    final ServletOutputStream stream = response.getOutputStream();
    if (PdfReportUtil.createPDF(report, stream) == false)
    {
    log("Failed to process the report");
    response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    return;
    }
    stream.flush();
    }
    catch (ResourceException e)
    {
    log("Failed to parse report", e);
    response.sendError(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    }
    }

    protected void doPost(final HttpServletRequest httpServletRequest,
    final HttpServletResponse httpServletResponse) throws ServletException, IOException
    {
    doGet(httpServletRequest, httpServletResponse);
    }
    }

    Already I added the jar files from lib folder of pentaho report desing to my library web application on neatbens.
    I use a jsp file to pass the name of file (reporte1.xml) as parameter to the servlet.

    I think it is working, but I got the report in blank only one page. if I do it stand alone the report I got 17pages. The neatbeans displays:


    DEBUG: Loaded a total of 39 modules under prefix: org.jfree.report.modules.
    DEBUG: ClassNotFound: org.jfree.report.ext.modules.barcode.base.BarcodeBaseModule
    DEBUG: ClassNotFound: org.jfree.report.ext.modules.barcode.io.BarcodeIOModule
    DEBUG: ClassNotFound: org.jfree.report.ext.modules.java14log.Java14LogModule
    DEBUG: ClassNotFound: org.jfree.report.ext.modules.log4jlog.Log4JLogModule
    DEBUG: Loaded a total of 11 modules under prefix: org.jfree.report.ext.modules.
    DEBUG: Loaded a total of 0 modules under prefix: org.jfree.report.userdefined.modules.
    DEBUG: Conf: org.jfree.report.JFreeReportCoreModule [core-module]
    DEBUG: Conf: org.jfree.report.modules.gui.common.GuiCommonModule [gui-common]
    DEBUG: Conf: org.jfree.report.modules.gui.config.ConfigGUIModule [gui-config]
    DEBUG: Conf: org.jfree.report.modules.parser.base.ParserBaseModule [xml-parser]
    DEBUG: Conf: org.jfree.report.modules.output.csv.CSVModule [output-csv]
    DEBUG: Conf: org.jfree.report.modules.output.table.base.TableBaseModule [output-table-base]
    DEBUG: Conf: org.jfree.report.modules.output.pageable.base.PageableBaseModule [output-pageable-base]
    DEBUG: Conf: org.jfree.report.modules.misc.configstore.base.ConfigStoreBaseModule [configstore]
    DEBUG: Conf: org.jfree.report.modules.misc.beanshell.BeanShellModule [misc-beanshell]
    DEBUG: Conf: org.jfree.report.modules.misc.bsf.BSFModule [misc-bsf]
    DEBUG: Conf: org.jfree.report.modules.misc.tablemodel.TableModelModule [misc-tablemodel]
    DEBUG: Conf: org.jfree.report.modules.misc.survey.SurveyModule [misc-survey]
    DEBUG: Conf: org.jfree.report.modules.output.xml.XMLModule [output-xml]
    DEBUG: Conf: org.jfree.report.ext.modules.java14imageio.Java14ImageIOModule [java-1.4-imageio]
    DEBUG: Conf: org.jfree.report.ext.modules.jfreechart.JFreeChartModule [jfreechart-content]
    DEBUG: Conf: org.jfree.report.ext.modules.rhino.RhinoModule [misc-bsf]
    DEBUG: Conf: org.jfree.report.ext.modules.svgimage.SVGImageModule [svgimage]
    DEBUG: Conf: org.jfree.report.modules.gui.commonswing.SwingCommonModule [gui-swing-common]
    DEBUG: Conf: org.jfree.report.modules.parser.simple.SimpleParserModule [xml-parser]
    DEBUG: Conf: org.jfree.report.modules.parser.ext.ExtParserModule [xml-parser]
    DEBUG: Conf: org.jfree.report.modules.output.table.csv.CSVTableModule [output-table-csv]
    DEBUG: Conf: org.jfree.report.modules.output.table.html.HtmlTableModule [output-table-html]
    DEBUG: Conf: org.jfree.report.modules.output.pageable.plaintext.PlainTextPageableModule [output-pageable-plaintext]
    DEBUG: Conf: org.jfree.report.modules.output.pageable.graphics.Graphics2DPageableModule [output-pageable-graphics]
    DEBUG: Conf: org.jfree.report.modules.output.table.xls.ExcelTableModule [output-table-xls]
    DEBUG: Conf: org.jfree.report.modules.misc.configstore.filesystem.FileConfigStoreModule [configstore]
    DEBUG: Conf: org.jfree.report.modules.misc.datafactory.DataFactoryModule [misc-datafactory]
    DEBUG: Conf: org.jfree.report.ext.modules.java14config.Java14ConfigModule [configstore]
    DEBUG: Conf: org.jfree.report.modules.gui.base.SwingPreviewModule [gui-swing-preview]
    DEBUG: Conf: org.jfree.report.modules.parser.extwriter.ExtWriterModule [parser-extwriter]
    DEBUG: Conf: org.jfree.report.modules.output.support.itext.BaseFontModule [output-support-itext]
    DEBUG: Conf: org.jfree.report.modules.parser.sql.SQLDataFactoryModule [factory-data-sql]
    DEBUG: Conf: org.jfree.report.modules.parser.staticdata.StaticDataFactoryModule [factory-data-static]
    DEBUG: Conf: org.jfree.report.modules.gui.converter.ConverterGUIModule [gui-converter]
    DEBUG: Conf: org.jfree.report.modules.gui.csv.CSVExportGUIModule [gui-csv]
    DEBUG: Conf: org.jfree.report.modules.gui.html.HtmlExportGUIModule [gui-html]
    DEBUG: Conf: org.jfree.report.modules.output.pageable.pdf.PdfPageableModule [output-pageable-pdf]
    DEBUG: Conf: org.jfree.report.modules.gui.plaintext.PlainTextExportGUIModule [gui-plaintext]
    DEBUG: Conf: org.jfree.report.modules.gui.print.AWTPrintingGUIModule [printing-gui]
    DEBUG: Conf: org.jfree.report.modules.output.table.rtf.RTFTableModule [output-table-rtf]
    DEBUG: Conf: org.jfree.report.modules.gui.xls.ExcelExportGUIModule [gui-xls]
    DEBUG: Conf: org.jfree.report.ext.modules.hibernate.HibernateDataFactoryModule [hibernate-datasources]
    DEBUG: Conf: org.jfree.report.modules.gui.pdf.PdfExportGUIModule [gui-pdf]
    DEBUG: Conf: org.jfree.report.modules.gui.rtf.RTFExportGUIModule [gui-rtf]
    DEBUG: Conf: org.jfree.report.modules.misc.referencedoc.ReferenceDocModule [misc-referencedoc]
    DEBUG: Conf: org.jfree.report.ext.modules.java14print.Java14PrintModule [printing-gui]
    INFO: Pixie library found. WMF file support will be available.
    DEBUG: Init: org.jfree.report.JFreeReportCoreModule [core-module]
    DEBUG: Init: org.jfree.report.modules.gui.common.GuiCommonModule [gui-common]
    DEBUG: Init: org.jfree.report.modules.gui.config.ConfigGUIModule [gui-config]
    DEBUG: Init: org.jfree.report.modules.parser.base.ParserBaseModule [xml-parser]
    DEBUG: Init: org.jfree.report.modules.output.csv.CSVModule [output-csv]
    DEBUG: Init: org.jfree.report.modules.output.table.base.TableBaseModule [output-table-base]
    DEBUG: Init: org.jfree.report.modules.output.pageable.base.PageableBaseModule [output-pageable-base]
    DEBUG: Init: org.jfree.report.modules.misc.configstore.base.ConfigStoreBaseModule [configstore]
    DEBUG: Init: org.jfree.report.modules.misc.beanshell.BeanShellModule [misc-beanshell]
    DEBUG: Init: org.jfree.report.modules.misc.bsf.BSFModule [misc-bsf]
    DEBUG: Init: org.jfree.report.modules.misc.tablemodel.TableModelModule [misc-tablemodel]
    DEBUG: Init: org.jfree.report.modules.misc.survey.SurveyModule [misc-survey]
    DEBUG: Init: org.jfree.report.modules.output.xml.XMLModule [output-xml]
    DEBUG: Init: org.jfree.report.ext.modules.java14imageio.Java14ImageIOModule [java-1.4-imageio]
    DEBUG: Init: org.jfree.report.ext.modules.jfreechart.JFreeChartModule [jfreechart-content]
    DEBUG: Init: org.jfree.report.ext.modules.rhino.RhinoModule [misc-bsf]
    DEBUG: Init: org.jfree.report.ext.modules.svgimage.SVGImageModule [svgimage]
    DEBUG: Init: org.jfree.report.modules.gui.commonswing.SwingCommonModule [gui-swing-common]
    DEBUG: Init: org.jfree.report.modules.parser.simple.SimpleParserModule [xml-parser]
    DEBUG: Init: org.jfree.report.modules.parser.ext.ExtParserModule [xml-parser]
    DEBUG: Init: org.jfree.report.modules.output.table.csv.CSVTableModule [output-table-csv]
    DEBUG: Init: org.jfree.report.modules.output.table.html.HtmlTableModule [output-table-html]
    DEBUG: Init: org.jfree.report.modules.output.pageable.plaintext.PlainTextPageableModule [output-pageable-plaintext]
    DEBUG: Init: org.jfree.report.modules.output.pageable.graphics.Graphics2DPageableModule [output-pageable-graphics]
    WARN: Unable to initialize the module output-table-xls
    org.jfree.base.modules.ModuleInitializeException: Unable to load POI classes.
    at org.jfree.report.modules.output.table.xls.ExcelTableModule.initialize(ExcelTableModule.java:76)
    at org.jfree.base.modules.PackageState.initialize(PackageState.java:184)
    at org.jfree.base.modules.PackageManager.initializeModules(PackageManager.java:240)
    at org.jfree.report.JFreeReportBoot.performBoot(JFreeReportBoot.java:320)
    at org.jfree.base.AbstractBoot.start(AbstractBoot.java:197)
    at dsrx.informedsrx1.init(informedsrx1.java:40)
    at javax.servlet.GenericServlet.init(GenericServlet.java:212)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:806)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    at java.lang.Thread.run(Thread.java:619)
    DEBUG: Init: org.jfree.report.modules.misc.configstore.filesystem.FileConfigStoreModule [configstore]
    DEBUG: Init: org.jfree.report.modules.misc.datafactory.DataFactoryModule [misc-datafactory]
    DEBUG: Java 1.4 Config module not active.
    DEBUG: Init: org.jfree.report.ext.modules.java14config.Java14ConfigModule [configstore]
    DEBUG: Init: org.jfree.report.modules.gui.base.SwingPreviewModule [gui-swing-preview]
    DEBUG: Init: org.jfree.report.modules.parser.extwriter.ExtWriterModule [parser-extwriter]
    DEBUG: Running on operating system: Linux
    DEBUG: Character encoding used as default: UTF-8
    DEBUG: Assuming unix like file structures
    WARN: Failed to create factory cache: com/opensymphony/oscache/general/GeneralCacheAdministrator
    INFO: Completed font registration.
    DEBUG: Running on operating system: Linux
    DEBUG: Character encoding used as default: UTF-8
    DEBUG: Assuming unix like file structures
    INFO: Completed font registration.
    DEBUG: Running on operating system: Linux
    DEBUG: Character encoding used as default: UTF-8
    DEBUG: Assuming unix like file structures
    WARN: Cannot embedd font: pfb-file for /usr/share/fonts/type1/gsfonts/n019003l.pfm is not valid (according to iText).
    WARN: Cannot embedd font: pfb-file for /usr/share/fonts/type1/gsfonts/n021004l.pfm is not valid (according to iText).
    WARN: Cannot embedd font: pfb-file for /usr/share/fonts/type1/gsfonts/b018015l.pfm is not valid (according to iText).
    WARN: Cannot embedd font: pfb-file for /usr/share/fonts/type1/gsfonts/a010035l.pfm is not valid (according to iText).
    WARN: Cannot embedd font: pfb-file for /usr/share/fonts/type1/gsfonts/n021023l.pfm is not valid (according to iText).
    WARN: Cannot embedd font: pfb-file for /usr/share/fonts/type1/gsfonts/b018032l.pfm is not valid (according to iText).
    WARN: Cannot embedd font: pfb-file for /usr/share/fonts/type1/gsfonts/n019004l.pfm is not valid (according to iText).
    WARN: Cannot embedd font: pfb-file for /usr/share/fonts/type1/gsfonts/a010033l.pfm is not valid (according to iText).
    WARN: Cannot embedd font: pfb-file for /usr/share/fonts/type1/gsfonts/a010015l.pfm is not valid (according to iText).
    WARN: Cannot embedd font: pfb-file for /usr/share/fonts/type1/gsfonts/a010013l.pfm is not valid (according to iText).
    WARN: Cannot embedd font: pfb-file for /usr/share/fonts/type1/gsfonts/n021003l.pfm is not valid (according to iText).
    WARN: Cannot embedd font: pfb-file for /usr/share/fonts/type1/gsfonts/z003034l.pfm is not valid (according to iText).
    WARN: Cannot embedd font: pfb-file for /usr/share/fonts/type1/gsfonts/n019064l.pfm is not valid (according to iText).
    WARN: Cannot embedd font: pfb-file for /usr/share/fonts/type1/gsfonts/b018012l.pfm is not valid (according to iText).
    WARN: Cannot embedd font: pfb-file for /usr/share/fonts/type1/gsfonts/n019023l.pfm is not valid (according to iText).
    WARN: Cannot embedd font: pfb-file for /usr/share/fonts/type1/gsfonts/n021024l.pfm is not valid (according to iText).
    WARN: Cannot embedd font: pfb-file for /usr/share/fonts/type1/gsfonts/b018035l.pfm is not valid (according to iText).
    WARN: Cannot embedd font: pfb-file for /usr/share/fonts/type1/gsfonts/n019024l.pfm is not valid (according to iText).
    INFO: Completed font registration.
    DEBUG: Init: org.jfree.report.modules.output.support.itext.BaseFontModule [output-support-itext]
    DEBUG: Init: org.jfree.report.modules.parser.sql.SQLDataFactoryModule [factory-data-sql]
    DEBUG: Init: org.jfree.report.modules.parser.staticdata.StaticDataFactoryModule [factory-data-static]
    DEBUG: Init: org.jfree.report.modules.gui.converter.ConverterGUIModule [gui-converter]
    DEBUG: Init: org.jfree.report.modules.gui.csv.CSVExportGUIModule [gui-csv]
    DEBUG: Init: org.jfree.report.modules.gui.html.HtmlExportGUIModule [gui-html]
    DEBUG: Init: org.jfree.report.modules.output.pageable.pdf.PdfPageableModule [output-pageable-pdf]
    DEBUG: Init: org.jfree.report.modules.gui.plaintext.PlainTextExportGUIModule [gui-plaintext]
    DEBUG: Init: org.jfree.report.modules.gui.print.AWTPrintingGUIModule [printing-gui]
    DEBUG: Init: org.jfree.report.modules.output.table.rtf.RTFTableModule [output-table-rtf]
    DEBUG: Init: org.jfree.report.modules.gui.xls.ExcelExportGUIModule [gui-xls]
    DEBUG: Init: org.jfree.report.ext.modules.hibernate.HibernateDataFactoryModule [hibernate-datasources]
    DEBUG: Init: org.jfree.report.modules.gui.pdf.PdfExportGUIModule [gui-pdf]
    DEBUG: Init: org.jfree.report.modules.gui.rtf.RTFExportGUIModule [gui-rtf]
    DEBUG: Init: org.jfree.report.modules.misc.referencedoc.ReferenceDocModule [misc-referencedoc]
    DEBUG: Init: org.jfree.report.ext.modules.java14print.Java14PrintModule [printing-gui]
    INFO: Pentaho Reporting Classic 0.8.9-rc6 started.
    INFO: Insufficient Data to create a pageformat: Returned default.
    WARN: Unknown tag <http://jfreereport.sourceforge.net/namespaces/reports/legacy/simple:description>: Start to ignore this element and all of its childs.
    WARN: Unknown tag <http://jfreereport.sourceforge.net/namespaces/reports/legacy/simple:bean-scripting-framework>: Start to ignore this element and all of its childs.
    WARN: Unknown tag <http://jfreereport.sourceforge.net/namespaces/reports/legacy/simpleaper>: Start to ignore this element and all of its childs.
    WARN: Unknown tag <http://jfreereport.sourceforge.net/namespaces/reports/legacy/simple:field>: Start to ignore this element and all of its childs.
    WARN: Unknown tag <http://jfreereport.sourceforge.net/namespaces/reports/legacy/simple:source>: Start to ignore this element and all of its childs.
    WARN: Unknown tag <http://jfreereport.sourceforge.net/namespaces/reports/legacy/simple:headers>: Start to ignore this element and all of its childs.
    WARN: Unknown tag <http://jfreereport.sourceforge.net/namespaces/reports/legacy/simple:footers>: Start to ignore this element and all of its childs.
    WARN: Unknown tag <http://jfreereport.sourceforge.net/namespaces/reports/legacy/simpleage>: Start to ignore this element and all of its childs.
    WARN: Unknown tag <http://jfreereport.sourceforge.net/namespaces/reports/legacy/simple:headers>: Start to ignore this element and all of its childs.
    WARN: Unknown tag <http://jfreereport.sourceforge.net/namespaces/reports/legacy/simple:footers>: Start to ignore this element and all of its childs.
    WARN: Unknown tag <http://jfreereport.sourceforge.net/namespaces/reports/legacy/simple:details>: Start to ignore this element and all of its childs.
    DEBUG: 8374450: Report processing time: Starting: Free: 3706672; Total: 10248192
    DEBUG: 8374450: Query processing time: Starting
    DEBUG: 8374450: Query processing time: 0.0010
    DEBUG: Pagination started ..
    DEBUG: Time to pagination 76
    DEBUG: Store: FunctionStorageKey{parentKey=null, subreportIndex=-1}
    DEBUG: Pagination-Time: 751
    DEBUG: 8374450: Report processing time: Pagination time: 0.751
    DEBUG: Time to pagination 309
    DEBUG: Store: FunctionStorageKey{parentKey=null, subreportIndex=-1}
    DEBUG: 8374450: Report processing time: 1.014
    DEBUG: 8374450: Report processing finished.


    what can I do?
    could you help me, please

  2. #2
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    The xml file you parse is definitely not a valid report-definition file for the Classic-Engine. The "unknown tags" the engine complains about are not defined in the Simple-XML report definition schema.
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

  3. #3

    Default

    What do I have to do?
    Please tell me

  4. #4
    Join Date
    Mar 2003
    Posts
    8,085

    Default

    where does the file come from that you try to parse? Thats the question. Once we know what file you try to parse, we can tell how to fix it.
    Get the latest news and tips and tricks for Pentaho Reporting at the Pentaho Reporting Blog.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.