Jump to content
  • Problems loading saved JasperPrintXMLs with newer JasperReports-Version


    C-Box
    Assigned User teodord
    CategoryBug report
    Component: 6865
    PriorityHigh
    ReproducibilityRandom
    ResolutionOpen
    SeverityCritical
    StatusNew
    Versionv4.7.0

    Hi Teodor,

     

    it's long time ago I posted a bugreport but now we have a critical problem with one of our major customers (~200 parallel Users).

    The customer just updated our ERP-System (running on JBoss) and switched from JasperReports 4.1.1 to 4.7.0 (always using javaflow versions).

     

    So far no problem. The whole printing stuff works fine.

     

    But the print-history makes sometimes (unfortunately not clearly reproduceable) problems.

     

    We save all printouts in JasperPrintXML format. We do so since several years (I guess from the beginning with using JasperReports 0.5.3!)

    We use this code for saving an JasperPrint:

     

    ....

    ByteArrayOutputStream outXML = new ByteArrayOutputStream();

     

    JRXmlExporter exporter = new JRXmlExporter();

    exporter.setParameter(JRExporterParameter.CLASS_LOADER,new AfpsDruckFontExtensionTTFLoader(Thread.currentThread().getContextClassLoader()));

    exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);

    exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, outXML);

    exporter.setParameter(JRXmlExporterParameter.IS_EMBEDDING_IMAGES, Boolean.TRUE);

    //exporter.setParameter(JRExporterParameter.CHARACTER_ENCODING,new String("UTF-8"));

    exporter.exportReport();

     

    return outXML.toByteArray();

     

    ...

    so this ByteArray is saved to database and can be reprinted or shown from our clients.

     

    This is how we load the saved ByteArray back to a JasperPrintObject:

     

    ByteArrayInputStream inXML = new ByteArrayInputStream(xml);

     

    JasperPrint jasperPrint = JRPrintXmlLoader.load(inXML);

    return jasperPrint;

     

     

    But after the update we got SOMETIMES this error when loading such a saved JasperPrintXML:

     

    net.sf.jasperreports.engine.JRException:

    org.xml.sax.SAXParseException:

    cvc-elt.1: Cannot find the declaration of element 'jasperPrint'.

    org.xml.sax.SAXParseException:

    cvc-elt.1: Cannot find the declaration of element 'jasperPrint'.

     

    Klasse:  net.sf.jasperreports.engine.xml.JRPrintXmlLoader

    Methode: loadXML

     

     

    ausgelöst durch:

                net.sf.jasperreports.engine.JRException:

                org.xml.sax.SAXParseException:

                cvc-elt.1: Cannot find the declaration of element 'jasperPrint'.

     

     

    The problem is, that it takes several minutes (!!) until the error is thrown and our system is locked during this time (the transaction hangs)

     

    As we can't reproduce it's difficult to track down the problem.

     

    The customer says, that the same saved printout could be opened fine after the first attempt that throws an error. So it's not clear why it doesn't work for the first time.

    It seems that it happend just with older exported versions (< 4.7.0) printouts .. but as I said NOT ALWAYS.

     

    Is this perhaps a ThreadProblem in the Digester-Class (as we run in JBoss Environment) ??

     

    Would be nice if you find some time to help us.

    regards from sunny Dresden/Germany

    Christian



    User Feedback

    Recommended Comments

    Same Problem here after upgrading from jasperreports 4.0.2 to 5.2.0 (only that we do not use JBoss).

     

    12:23:14 (130:192.168.115.3) : org.xml.sax.SAXParseException; lineNumber: 4; columnNumber: 171; cvc-elt.1: Cannot find the declaration of element 'jasperPrint'.

    12:23:14 (130:192.168.115.3) : Exception: net.sf.jasperreports.engine.JRException

    12:23:14 (130:192.168.115.3) : net.sf.jasperreports.engine.xml.JRPrintXmlLoader.loadXML(JRPrintXmlLoader.java:216)

    12:23:14 (130:192.168.115.3) : net.sf.jasperreports.engine.xml.JRPrintXmlLoader.load(JRPrintXmlLoader.java:169)

    12:23:14 (130:192.168.115.3) : net.sf.jasperreports.engine.xml.JRPrintXmlLoader.load(JRPrintXmlLoader.java:180)

    Link to comment
    Share on other sites


×
×
  • Create New...