The execution of the method "ReporteListadoVehiculos()" only displays up to the line "JasperPrint j = JasperFillManager.fillReport(report, null, conectar());", and apparently there's an error that avoids continuing the execution.
How can I find the error that is avoiding the execution of the report, and which are the steps I should follow to fix this tipe of problems?
This is the code I'm using to execute the report:
package domainapp.modules.simple.dominio.reportes;
import java.io.File;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JOptionPane;
import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.util.JRLoader;
import net.sf.jasperreports.view.JasperViewer;
public class EjecutarReportes {
public static Connection conectar() {
Connection con = null;
try {
String url = "jdbc:postgresql://127.0.0.1:5432/adet?user=adetuser&password=Passw0rd";
con = DriverManager.getConnection(url);
if (con != null) {
System.out.println("Conexion Satisfactoria");
}
} catch (SQLException e) {
System.out.println(e.getMessage());
}
return con;
}
public void ReporteListadoVehiculos(){
try {
File ruta = new File("C:\\Users\\4G\\Desktop\\Proyecto_Final\\Codigo\\AdeT\\module-simple\\src\\main\\java\\domainapp\\modules\\simple\\dominio\\reportes\\ListadoVehiculos.jasper");
JasperReport report = (JasperReport) JRLoader.loadObject(ruta);
JasperPrint j = JasperFillManager.fillReport(report, null, conectar());
JasperViewer jv = new JasperViewer(j,false);
jv.setTitle("Listado de Vehiculos");
jv.setVisible(true);
} catch (Exception e) {
JOptionPane.showMessageDialog(null, "Error al mostrar el Reporte: "+e);
}
}
}