JRXML unable to load

0

However I try to load my JRXML, I keep getting this error:

    net.sf.jasperreports.engine.JRException: org.xml.sax.SAXException: http://java.sun.com/xml/jaxp/properties/schemaSource

Here is my code:

    public class DownloadService {
        public static final String TEMPLATE = "C:/reports/report.jrxml";
        protected static Logger logger = Logger.getLogger("service");
    
        Connection conn;
    
        public void download(String type, HashMap params, HttpServletResponse response) throws FileNotFoundException {
            try {
                //conn =jspDAO.getSqlSession().getConnection();
    
                try {
                    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
                    conn = DriverManager.getConnection(
                            "jdbc:oracle:thin:@xxx.xxx.xxx.xxx:1521:test", "test",
                            "test"); //censored
                    System.out.println("Getting connection.....");
                    System.out.println(conn);
                } catch (Exception e) {
                    e.printStackTrace();
                }
    
    
                InputStream reportStream = new FileInputStream(TEMPLATE);
                System.out.println("Retrieved template");
                // 3. Convert template to JasperDesign
                System.out.println("Loading jrxml");
                System.out.println(reportStream.toString());
                JasperDesign jd = JRXmlLoader.load(reportStream);
                System.out.println("Loaded jrxml");
                // 4. Compile design to JasperReport
                System.out.println("Compiling JasperReport");
                JasperReport jr = JasperCompileManager.compileReport(jd);
                System.out.println("Compiled JasperReport");
                // 5. Create the JasperPrint object
                // Make sure to pass the JasperReport, report parameters, and data source
                System.out.println("Creating JasperReport");
                JasperPrint jp = JasperFillManager.fillReport(jr, params, conn);
                System.out.println("Created JasperReport");
                // 7. Export report
                System.out.println("Exporting report");
                JasperExportManager.exportReportToPdfFile(jp, "C:/reports/pdfOutput.pdf");
            } catch (JRException jre) {
                logger.error("Unable to process download");
                logger.error(jre);
                throw new RuntimeException(jre);
            }
        }
    }


I am unable to get past JasperDesign jd = JRXmlLoader.load(reportStream);

Here is what my logger outputs:

    weblogic.servlet.internal.ServletResponseImpl@a4120d
    Getting connection.....
    oracle.jdbc.driver.T4CConnection@105036e
    Retrieved template
    Loading jrxml
    java.io.FileInputStream@8aed09
    106428815 [ExecuteThread: '14' for queue: 'weblogic.kernel.Default'] WARN component.ComponentsEnvironment  - Found two components for namespace http://jasperreports.sourceforge.net/jasperreports/components
    net.sf.jasperreports.engine.JRException: org.xml.sax.SAXException: http://java.sun.com/xml/jaxp/properties/schemaSource
        at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:243)
        at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:226)
        at net.sf.jasperreports.engine.xml.JRXmlLoader.load(JRXmlLoader.java:214)
        at com.jasperreport.biz.DownloadService.download(DownloadService.java:97)
        at com.jasperreport.biz.JasperService.print(JasperService.java:29)
        at com.jasperreport.presentation.JasperController.printReport(JasperController.java:57)
        at com.jasperreport.presentation.JasperController.doPost(JasperController.java:35)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1077)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465)
        at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:348)
        at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:7047)
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
        at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
        at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3902)
        at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2773)
        at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224)
        at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183)
    Caused by: org.xml.sax.SAXException: http://java.sun.com/xml/jaxp/properties/schemaSource
        at weblogic.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1203)
        at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:135)
        at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:152)
        at org.apache.commons.digester.Digester.parse(Digester.java:1647)
        at net.sf.jasperreports.engine.xml.JRXmlLoader.loadXML(JRXmlLoader.java:239)
        ... 18 more

Is there anything that I could try to solve this?

EDIT

I am unable to post my XML, but it was created with iReports 3.1.3. I am using JasperReport 3.5.3 due to compatibility issues with the latest versions.

 

zwseow's picture
22
Joined: May 28 2013 - 6:55pm
Last seen: 2 years 9 months ago

1 Answer:

0

I changed to iReports 3.0.0. It's now working.

zwseow's picture
22
Joined: May 28 2013 - 6:55pm
Last seen: 2 years 9 months ago
Feedback