I am trying to run a report in Jasper Report
with the following code:
Class.forName("org.postgresql.Driver");
Connection conexion = DriverManager.getConnection("jdbc:postgresql://localhost:5432/reportes", usuario, contraseña;
File reportDir=new File(getServletContext().getRealPath("WEB-INF/repProd.jasper"));
JasperReport reporte= (JasperReport) JRLoader.loadObject(reportDir);
JasperPrint jasperPrint = JasperFillManager.fillReport(reporte, null, conexion);
JRExporter exporter = new JRPdfExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);
exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, out);//new java.io.File("reportePDF.pdf")
exporter.exportReport();
However, it generates an error in the line:
JasperReport reporte= (JasperReport) JRLoader.loadObject(reportDir);
The error is as follows:
The Servlet.service () for the servlet [SrvRepProd] in the context with route [/ Application] launched the exception [Execution of Servlet launched an exception] with root cause java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory
Any ideas?