jasper-reportsireportjaspersoft-studio

Jaspersoft Studio adding uuid when data adapter is changed for report


I am currently in the process of moving from iReport 4.5.1 to Jaspersoft Studio 5.5. I notice when I change the data adapter in Jaspersoft Studio it adds the uuid tag to the XML of the report.

I have different connections to different databases but I hate having to go into Notepad++ to strip out the uuid="..." out of the XML. Why I keep getting this error when I change which data adapter the report is using?

I originally looked at this issue and while it worked for one connection when I changed the connection of the report (to look from my development database to staging database) it put the uuid's back in the report. When I test the report in development I remove the uuid's and it works, when I change to test the report in staging it puts them back.

Error loading the report template


Message:
    net.sf.jasperreports.engine.JRException: org.xml.sax.SAXParseException: cvc-     complex-type.3.2.2: Attribute 'uuid' is not allowed to appear in element 'jasperReport'.
Level:
SEVERE
Stack Trace:
org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'uuid' is not allowed  to appear in element 'jasperReport'.
    net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:247)
net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:230)
net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:218)
com.jaspersoft.ireport.designer.JrxmlLoader.reloadJasperDesign(JrxmlLoader.java:87)
com.jaspersoft.ireport.designer.JrxmlVisualView.run(JrxmlVisualView.java:505)
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)
cvc-complex-type.3.2.2: Attribute 'uuid' is not allowed to appear in element  'jasperReport'.
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:423)
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3188)
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processAttributes(XMLSchemaValidator.java:2665)
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:2072)
com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:711)
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:626)
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3104)
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:921)
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:647)
com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1205)
 com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:522)
org.apache.commons.digester.Digester.parse(Digester.java:1892)
net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:243)
net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:230)
net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:218)
com.jaspersoft.ireport.designer.JrxmlLoader.reloadJasperDesign(JrxmlLoader.java:87)
com.jaspersoft.ireport.designer.JrxmlVisualView.run(JrxmlVisualView.java:505)
org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:572)
org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:997)

Solution

  • I think the UUID attribute was introduced in JasperReports 4.6.0. Therefore in order to get rid of it, you should set the compatibility mode to use JasperReports 4.5.0. This because every new version of Jaspersoft Studio or even iReport, uses the last version available of the JR library.

    In Jaspersoft Studio you can set the compatibility mode at global level via "Window > Preferences > Jaspersoft Studio", then via the combo select 4.5.0 version. This will apply settings at workspace level. However you can customize this information via the project properties or even file properties. This can be really useful in common use case where you want to use the last JR version for all your reports, but you have a specific report that you want to be "JR 4.5.0" compliant.

    Hope this solves your doubts and question.

    Best regards, Massimo.

    P.S: Below screenshots of the configuration pages

    Workspace level Settings

    Project level Settings

    File level Settings