We have created reports using iReport4.5.1. It is working properly in iReport.
After that we have integrated reports to our Application. We build our application using maven. Following is the JasperReports dependencies in pom.xml
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>4.5.1</version>
</dependency>
<dependency>
<groupId>jasperreports-javaflow</groupId>
<artifactId>jasperreports-javaflow</artifactId>
<version>4.5.1</version>
</dependency>
and following is the Java code which generate the report :
String jrxmlFilePath = getConfigBundle().getString("jasper.templates.jrxml.path");
String jasperFilePath = getConfigBundle().getString("jasper.templates.jasper.path");
JasperCompileManager.compileReportToFile(jrxmlFilePath, jasperFilePath);
File jasperFile = new File(jasperFilePath);
Connection conn = setUpDataSource();
HashMap jasperParameter = setUpJasperParameterForPackingList(truckId, rackId, jasperFile);
JasperPrint jprint = JasperFillManager.fillReport(jasperFilePath, jasperParameter, conn);
ByteArrayOutputStream reportOutputStream = new ByteArrayOutputStream();
JasperExportManager.exportReportToPdfStream(jprint, reportOutputStream);
return reportOutputStream;
When I call this code it will give me following error :
ERROR - [DGU_ACTION_SERVLET] ServletException
javax.servlet.ServletException: net.sf.jasperreports.engine.JRRuntimeException: Error creating SAX parser
at org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:535)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:433)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at com.saintgobain.dgu.mvc.action.DguActionServlet.process(DguActionServlet.java:41)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: net.sf.jasperreports.engine.JRRuntimeException: Error creating SAX parser
at net.sf.jasperreports.engine.xml.BaseSaxParserFactory.createParser(BaseSaxParserFactory.java:99)
at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createParser(JRXmlDigesterFactory.java:1342)
at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createDigester(JRXmlDigesterFactory.java:1318)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:207)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:172)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:156)
at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:108)
at com.saintgobain.dgu.helper.ExportReportPDFHelper.printPackingListJasper(ExportReportPDFHelper.java:287)
at com.saintgobain.dgu.helper.ExportReportPDFHelper.generatePDF4PackingList(ExportReportPDFHelper.java:353)
at com.saintgobain.dgu.mvc.action.shipping.ExportShippingReportAction.execute(ExportShippingReportAction.java:79)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
... 22 more
Caused by: org.xml.sax.SAXNotRecognizedException: Property: http://java.sun.com/xml/jaxp/properties/schemaLanguage
at org.apache.crimson.parser.XMLReaderImpl.setProperty(XMLReaderImpl.java:266)
at org.apache.crimson.jaxp.SAXParserImpl.setProperty(SAXParserImpl.java:183)
at net.sf.jasperreports.engine.xml.BaseSaxParserFactory.configureParser(BaseSaxParserFactory.java:132)
at net.sf.jasperreports.engine.xml.BaseSaxParserFactory.createParser(BaseSaxParserFactory.java:94)
... 32 more
ERROR - [DGU_ACTION_SERVLET] ServletException - root cause
net.sf.jasperreports.engine.JRRuntimeException: Error creating SAX parser
at net.sf.jasperreports.engine.xml.BaseSaxParserFactory.createParser(BaseSaxParserFactory.java:99)
at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createParser(JRXmlDigesterFactory.java:1342)
at net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createDigester(JRXmlDigesterFactory.java:1318)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:207)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:172)
at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:156)
at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:108)
at com.saintgobain.dgu.helper.ExportReportPDFHelper.printPackingListJasper(ExportReportPDFHelper.java:287)
at com.saintgobain.dgu.helper.ExportReportPDFHelper.generatePDF4PackingList(ExportReportPDFHelper.java:353)
at com.saintgobain.dgu.mvc.action.shipping.ExportShippingReportAction.execute(ExportShippingReportAction.java:79)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
at com.saintgobain.dgu.mvc.action.DguActionServlet.process(DguActionServlet.java:41)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1001)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:585)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
Caused by: org.xml.sax.SAXNotRecognizedException: Property: http://java.sun.com/xml/jaxp/properties/schemaLanguage
at org.apache.crimson.parser.XMLReaderImpl.setProperty(XMLReaderImpl.java:266)
at org.apache.crimson.jaxp.SAXParserImpl.setProperty(SAXParserImpl.java:183)
at net.sf.jasperreports.engine.xml.BaseSaxParserFactory.configureParser(BaseSaxParserFactory.java:132)
at net.sf.jasperreports.engine.xml.BaseSaxParserFactory.createParser(BaseSaxParserFactory.java:94)
... 32 more
- we are using the both iReport and JasperReports version as 4.5.1
- I have put the XercesImpl.jar (version 2.8.1) dependency in class path
- we are using Jdk.1.6.0_33
Please help How do I remove this error?