Y have a problem with this Code
@Stateless @Name("reporte") public class ReporteBean implements Reporte{ @Logger Log log; @In Identity identity; @Resource(mappedName = Constantes.DATA_SOURCE) protected DataSource dataSource; public ReporteBean() { } public void crearArchivo() { Connection conn = null; try { conn = dataSource.getConnection(); } catch (Exception e) { log.error(" ================= ERROR en ReporteBean.crearPdf ", e); } finally { try { if (conn != null) conn.close(); } catch (SQLException sqle) { log.error(" ========================= ERROR AL CERRAR LA CONNECCION CON LA BASE DE DATOS ReporteBean.crearPdf ", sqle); } } } }
When I Call Method crearArchivo() from regionList y have a NullPointerException in this line: conn = dataSource.getConnection(); but I have another Class like This
@Stateless @Name("reportesFt") public class ReportesFtBean extends ReporteBean implements ReportesFt { public ReportesFtBean() { } @Override public void listadoRegiones() { this.crearArchivo(); } ...
And When i call method from listadoRegiones() it works fine, somebody may explain me where is the error, I would call method from regionList(), because I need make more reports.
thanks in advance for your help.