Oi gente , to tentando começar com o JasperReport e Ireport aki no meu projeto
Criei um relatorio no Ireport e compilei ele, ate ai blz
Mas na hora de mandar rodar ele no java da dando problema, uso o seguinte metodo
public static void main(String[] args) {
JasperReport jasperReport;
JasperPrint jasperPrint;
try {
jasperPrint = JasperFillManager.fillReport(
"./jasper/IdadeSalesianosBranco.jasper", new HashMap(), new ConexaoMySQL().getConnection());
JasperExportManager.exportReportToPdfFile(
jasperPrint, "./jasper/simple_report.pdf");
} catch (JRException e) {
e.printStackTrace();
}
}
E estou o obtendo o seguinte erro
Exception in thread "main" java.lang.NullPointerException
at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:123)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:420)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:256)
at br.salesianos.teste.Relatorio1.main(Relatorio1.java:27)
Java Result: 1
Alguém sabe como fazer funcionar ou o motivo deste erro
Ai esta minha classe ConexaoMysql
public Connection getConnection() {
try {
Class.forName("com.mysql.jdbc.Driver");
String driver = "jdbc:mysql://localhost/curriculosdb";
Connection con = DriverManager.getConnection(driver, "root", "");
return con;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}