compilation error: ireport with java;Attribute 

2019-01-12 08:44发布

问题:

This question already has an answer here:

  • cvc-complex-type.3.2.2 attribute 'uuid' is not allowed to appear in element 'jasperreport' 8 answers

i'm working with ireport but when i try to compile it with a class java a error appear.

Exception in thread "main" 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'.
    at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:247)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:230)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:218)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:172)
    at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:156)

thanks for your help :)

回答1:

It is Compatibility issue in the ireport. when you are going to open .jrxml in older version of ireport then the version you have created it before you wil get this error. To fix it just strip out the uuid attribute and open it again in the ireport.



回答2:

It is because there is an error in your jrxml file uuid field should be misplaced. If you use ireport tool then you will no need to write jrxml file by your own you will just need to add the bean properties as a filed in that tool and specify its properties and you will get jrxml generated automatically.

I can help you on jasper reports becasue I worked on it for few months on complex reports.