Error creating SAX parser

0

I am adapting one java application in order to generate a dynamic Reports. This project is using jasperReports. I am not able to run the code bellow, meanwhile other person with the same code is able to run it. Perhaps we have configurations different in our Eclipse and pom.xml

Code:

String reportOutput = reportOutputLocation+reportName;

InputStream reportTemplate = getClass().getClassLoader().getResourceAsStream(reportSrcLocation);

JasperDesign jasperDesign = JRXmlLoader.load(reportTemplate);

JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);

Map paramObjects = new HashMap(); paramObjects.putAll(parameters);,>,>

JasperPrint jprint = JasperFillManager.fillReport(jasperReport, paramObjects, conn);,>,>

But when I execute this line (JRXmlLoader.load(reportTemplate);) it throws me the error bellow:

net.sf.jasperreports.engine.JRRuntimeException: Error creating SAX parser

net.sf.jasperreports.engine.xml.BaseSaxParserFactory.createParser(BaseSaxParserFactory.java:99)

net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createParser(JRXmlDigesterFactory.java:1456)

net.sf.jasperreports.engine.xml.JRXmlDigesterFactory.createDigester(JRXmlDigesterFactory.java:1432)

net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:262)

net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:247)

java.lang.Thread.run(Unknown Source)

I have checked and the InputStream and it is fine.

 

guilherme.reis's picture
Joined: Feb 23 2017 - 11:30am
Last seen: 2 years 5 months ago

1 Answer:

0
As I knew the code was working fine and the issue was in the project setup. The pom.xml was fine and also the dependencys.
 
What I did in order to get this working was double click on tomcat server on Eclipse.
 
    - Download xercesImpl-2.8.1.jar or any other version
    - Click on "Open Launch Configuration"
    - Go to the tab "Classpath"
    - Click on Bootstrap Entries
    - Add External JARs
    - Select xercesImpl-2.8.1.jar or any version that you prefer.
 
Restart server and it should work.
 

 

guilherme.reis's picture
Joined: Feb 23 2017 - 11:30am
Last seen: 2 years 5 months ago
Feedback
randomness