mp_we Posted October 2, 2007 Share Posted October 2, 2007 Hello, I created a report using iReport2.0.1 using a style template file. It executes in iReport and displays the PDF report.But when I try to run it in a Servlet (using jasperreports-2.0.1.jar), it throws the following exception:org.apache.commons.digester.Digester errorSEVERE: Parse Error at line 29 column 11: <Line 29, Column 11>: XML-20148: (Error) Invalid element 'template' in content of 'jasperReport', expected elements '[field, sortField, variable, filterExpression, group, background, title, pageHeader, columnHeader, detail, columnFooter, pageFooter, lastPageFooter, summary, noData]'. Here are the first few lines of the .jrxml. Code:<?xml version="1.0" encoding="UTF-8" ?><!-- Created with iReport - A designer for JasperReports --><!DOCTYPE jasperReport PUBLIC "//JasperReports//DTD Report Design//EN" "http://jasperreports.sourceforge.net/dtds/jasperreport.dtd"><jasperReport name="Data_profile" columnCount="1" printOrder="Vertical" orientation="Portrait" pageWidth="595" pageHeight="842" columnWidth="535" columnSpacing="0" leftMargin="30" rightMargin="30" topMargin="20" bottomMargin="20" whenNoDataType="NoPages" isTitleNewPage="false" isSummaryNewPage="false"> <property name="ireport.scriptlethandling" value="0" /> <property name="ireport.encoding" value="UTF-8" /> <import value="java.util.*" /> <import value="net.sf.jasperreports.engine.*" /> <import value="net.sf.jasperreports.engine.data.*" /> <queryString language="xPath"><![CDATA[/profile_hist/profile_histRow]]></queryString> <template>"styles.jrtx"</template> <field name="FullName" class="java.lang.String"> <fieldDescription><![CDATA[FullName]]></fieldDescription> </field> Any ideas on what could be going on?Thank you. Link to comment Share on other sites More sharing options...
tnodev Posted November 22, 2007 Share Posted November 22, 2007 Pb with http://jasperreports.sourceforge.net/dtds/jasperreport.dtd It doesn't contain the template element! So the xml parser is unhappy :( Link to comment Share on other sites More sharing options...
lucianc Posted November 22, 2007 Share Posted November 22, 2007 Could you post the full exception stacktrace? The DTD should be resolved internally to a resource located in the JasperReports jar. However, it's possible that some XML parsers would fail to properly employ the entity resolver. Which XML parser do you use? Could you include a Xerces jar on your classpath and try to compile the report? We're going to update the public DTD so that external tools would always use the latest version. Regards,Lucian Link to comment Share on other sites More sharing options...
tnodev Posted November 22, 2007 Share Posted November 22, 2007 My full exception, I think using Xerces... checking Code: [jrc] Error compiling report design : E:devworkspacesGemarcurArcReportsrcarcreportpassifecheancierReportEcheancier.jrxml [jrc] net.sf.jasperreports.engine.JRException: org.xml.sax.SAXParseException: Element type "template" must be declared. [jrc] at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:242) [jrc] at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:225) [jrc] at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:213) [jrc] at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:167) [jrc] at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:151) [jrc] at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:107) [jrc] at net.sf.jasperreports.ant.JRAntCompileTask.compile(JRAntCompileTask.java:398) [jrc] at net.sf.jasperreports.ant.JRAntCompileTask.execute(JRAntCompileTask.java:252) [jrc] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288) [jrc] at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source) [jrc] at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) [jrc] at java.lang.reflect.Method.invoke(Unknown Source) [jrc] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105) [jrc] at org.apache.tools.ant.Task.perform(Task.java:348) [jrc] at org.apache.tools.ant.Target.execute(Target.java:357) [jrc] at org.apache.tools.ant.Target.performTasks(Target.java:385) [jrc] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329) [jrc] at org.apache.tools.ant.Project.executeTarget(Project.java:1298) [jrc] at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41) [jrc] at org.eclipse.ant.internal.ui.antsupport.EclipseDefaultExecutor.executeTargets(EclipseDefaultExecutor.java:32) [jrc] at org.apache.tools.ant.Project.executeTargets(Project.java:1181) [jrc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:423) [jrc] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137) [jrc] Caused by: org.xml.sax.SAXParseException: Element type "template" must be declared. [jrc] at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) [jrc] at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source) [jrc] at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) [jrc] at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source) [jrc] at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source) [jrc] at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(Unknown Source) [jrc] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source) [jrc] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source) [jrc] at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source) [jrc] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) [jrc] at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source) [jrc] at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source) [jrc] at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source) [jrc] at org.apache.commons.digester.Digester.parse(Digester.java:1647) [jrc] at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:238) [jrc] ... 22 morePost edited by: tnodev, at: 2007/11/22 15:32 Link to comment Share on other sites More sharing options...
lucianc Posted November 23, 2007 Share Posted November 23, 2007 This seems to be a Xerces version bundled with a JDK (btw, what JDK are you using?). Could you try including a Xerces jar from Apache on your classpath? Regards,Lucian Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now