12

I have a textfield in my rreport which I am using with my SpringBoot Maven application. The textfield is populated and the content is variable in size and I want a dynamic size textBox. I am using JasperSoft designer to build the report and the JasperReports version is 6.11.0.

Following is the code segment for the textBox

<textField textAdjust="StretchHeight">
            <reportElement x="160" y="92" width="330" height="18" uuid="3d60c5f2-9fca-4c15-af62-0753befg4ad6"/>
            <textElement markup="rtf"/>
            <textFieldExpression><![CDATA[$F{instructions}]]></textFieldExpression>
</textField>

Following is the pom.xml

<dependency>
        <groupId>net.sf.jasperreports</groupId>
        <artifactId>jasperreports</artifactId>
        <version>6.11.0</version>
</dependency>

and the error

2020-01-03 14:16:20.403  INFO 11516 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat-1].[localhost].[/]     : Initializing Spring DispatcherServlet 'dispatcherServlet'
2020-01-03 14:16:20.403  INFO 11516 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2020-01-03 14:16:20.408  INFO 11516 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 5 ms
2020-01-03 14:16:20.450 ERROR 11516 --- [nio-8080-exec-1] org.apache.commons.digester.Digester     : Parse Error at line 262 column 42: cvc-complex-type.3.2.2: Attribute 'textAdjust' is not allowed to appear in element 'textField'.

org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute 'textAdjust' is not allowed to appear in element 'textField'.
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:203) ~[na:1.8.0_211]
        at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134) ~[na:1.8.0_211]
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:396) [na:1.8.0_211]
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:327) [na:1.8.0_211]
        at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:284) [na:1.8.0_211]
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:453) [na:1.8.0_211]
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3231) [na:1.8.0_211]
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processAttributes(XMLSchemaValidator.java:2708) [na:1.8.0_211]
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:2051) [na:1.8.0_211]
        at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:741) [na:1.8.0_211]
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:374) [na:1.8.0_211]
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784) [na:1.8.0_211]
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602) [na:1.8.0_211]
        at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112) [na:1.8.0_211]
        at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505) [na:1.8.0_211]
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:842) [na:1.8.0_211]
        at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:771) [na:1.8.0_211]
        at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141) [na:1.8.0_211]
        at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213) [na:1.8.0_211]
        at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643) [na:1.8.0_211]
        at org.apache.commons.digester.Digester.parse(Digester.java:1892) [commons-digester-2.1.jar:2.1]
        at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:298) [jasperreports-6.4.0.jar:6.4.0]
        at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:285) [jasperreports-6.4.0.jar:6.4.0]
        at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:274) [jasperreports-6.4.0.jar:6.4.0]
        at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:248) [jasperreports-6.4.0.jar:6.4.0]


The maven dependencies does contain the jasperreports-6.11.0.jar.

Please suggest what could be wrong here.

Alex K
  • 22,315
  • 19
  • 108
  • 236
Nitin Nanda
  • 805
  • 2
  • 11
  • 27
  • 1
    The *textAdjust* is not supported attribute (tag) for your version of JR library (used by classloader) – Alex K Jan 03 '20 at 20:33
  • 1
    You can save template with support of previous version (6.4.3, for example) of JasperReports library at Studio – Alex K Jan 03 '20 at 20:36
  • Does that mean I should not use jasperreports 6.11.0 if I wish to use this stretch type functionality and should switch to a previous version. – Nitin Nanda Jan 03 '20 at 20:42
  • 3
    As you can see from your stacktrace you are using *jasperreports-6.4.0* library, not the 6.11.0 version. Please look at this line: `at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:248) [jasperreports-6.4.0.jar:6.4.0]` – Alex K Jan 03 '20 at 20:42
  • ohh my bad. I will update it and update here if it is resolved – Nitin Nanda Jan 03 '20 at 20:44
  • 1
    As suggested by Alex, my program was not using the 6.11.0 version although I had it in the maven dependencies. I deleted the contents of the .m2 folder and rebuilt it and it solved the issue. – Nitin Nanda Feb 21 '20 at 03:11

0 Answers0