1
I have an app JavaFX
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);
}
}
What is the version of your JDK?
– Math
1.8, may be lack of libraries?
– DiegoAugusto
I don’t know, but I’ve had a similar problem and I "think" that I resolved by upgrading from 1.7u25 to 1.7u45. I still have that question open and have not set up a testing environment to come to a conclusion. But in your case, the problem could be something else, and I can’t say at first which.
– Math
All right, I’ll poke around here and see what I can do. The hard part is that it doesn’t show the error line rsrs.
– DiegoAugusto
Yeah, I’ve been there, and it’s terrible. It seems like some bug in the language, I don’t know.
– Math
Let’s see, thanks for trying to help
– DiegoAugusto