Estou tentando usar o JasperReport e Spring Boot 2.0, mas ao tentar usar o método fillReport tenho uma exception:
java.io.FileNotFoundException: file:/home/usuario/projetos/projeto-exemplo/target/classes/reports/relatorio.jasper
Quando vou no caminho acima o arquivo está lá corretamente. Não entendi o motivo do erro. Segue a parte do código:
@GetMapping("/relatorio/pdf")
public ModelAndView relatorio() throws JRException {
Map<String, Object> parametros = new HashMap<>();
String path = "/reports/relatorios.jasper";
JasperPrint print = JasperFillManager.fillReport(getClass().getResource(path).toString(),
parametros, new JRBeanCollectionDataSource(service.listarTodos()));
JasperViewer.viewReport(print);
/*... */
}
O relatório está em minha pasta src/main/resources/reports e aparece na pasta target/classes/reports/ após a compilação.