I have a JavaFX
application where I have a button that generates reports. But when I try to generate the report this error happens:
Exception in thread "JavaFX Application Thread" java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
This is my method that generates the report:
@FXML
private void gerarRelatorio(){
try {
Map<String, Object> filtro = new HashMap<>();
InputStream image = this.getClass().getResourceAsStream("/br/com/justi/view/relatorios/leaf_banner_green.png");
filtro.put("status", cbStatus.getValue().toString());
filtro.put("IMAGE", image);
InputStream inputStreamReal = getClass().getResourceAsStream("/br/com/justi/view/relatorios/contratos.jasper");
JasperPrint jasperPrint = JasperFillManager.fillReport(inputStreamReal, filtro, ConexaoMysql.abrir());
JasperViewer jrviewer = new JasperViewer(jasperPrint, false);
jrviewer.setVisible(true);
jrviewer.toFront();
} catch (JRException ex) {
JOptionPane.showMessageDialog(null, ex);
} catch (Exception ex) {
Logger.getLogger(FrmListarCadastrosController.class.getName()).log(Level.SEVERE, null, ex);
}
}