Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0047943Openbravo ERPB. User interfacepublic2021-10-27 15:272022-12-14 12:54
lbressan 
lbressan 
normalmajoralways
closedunable to reproduce 
5
pi 
 
Core
2021-11-08
No
0047943: Reports that contain images stop working after upgrading from 18Q3 to 21Q2.3
No images are printed on subreports
Here I leave the error that throws by log:
Caused by: java.sql.SQLException: PooledConnection has already been closed.
at org.apache.tomcat.jdbc.pool.DisposableConnectionFacade.invoke(DisposableConnectionFacade.java:87) ~[tomcat-jdbc.jar:?]
at com.sun.proxy.$Proxy57.prepareStatement(Unknown Source) ~[?:?]
at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createStatement(JRJdbcQueryExecuter.java:267) ~[jasperreports-6.0.0.jar:6.0.0]
at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:196) ~[jasperreports-6.0.0.jar:6.0.0]
at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:1119) ~[jasperreports-6.0.0.jar:6.0.0]
1) Go to the sale "Sales Order"

2) Select an Order and modify it in JasperSoft

3) Add an image in the subreport in Jaspersoft

4) Try to print the report again in Backoffice

5) It may be observed that the report with the added image is not printed
No tags attached.
Issue History
2021-10-27 15:27lbressanNew Issue
2021-10-27 15:27lbressanAssigned To => platform
2021-10-27 15:27lbressanModules => Core
2021-10-27 15:27lbressanRegression date => 2021-11-08
2021-10-27 15:27lbressanTriggers an Emergency Pack => No
2021-10-29 13:12AugustoMauchNote Added: 0132758
2021-10-29 13:12AugustoMauchAssigned Toplatform => lbressan
2021-10-29 13:12AugustoMauchStatusnew => feedback
2021-10-29 13:12AugustoMauchSummaryReports stop working after upgrading from 18Q3 to 21Q2.3 => Reports with images stop working after upgrading from 18Q3 to 21Q2.3
2021-10-29 13:12AugustoMauchSummaryReports with images stop working after upgrading from 18Q3 to 21Q2.3 => Reports that contain images stop working after upgrading from 18Q3 to 21Q2.3
2021-11-01 15:21lbressanNote Added: 0132768
2021-11-17 14:18dromeroNote Added: 0133152
2021-11-24 16:45dromeroNote Added: 0133330
2021-11-25 17:18cbernerNote Added: 0133374
2021-11-25 17:20cbernerNote Edited: 0133374bug_revision_view_page.php?bugnote_id=0133374#r23362
2022-12-14 12:54AugustoMauchNote Added: 0144672
2022-12-14 12:54AugustoMauchStatusfeedback => closed
2022-12-14 12:54AugustoMauchResolutionopen => unable to reproduce

Notes
(0132758)
AugustoMauch   
2021-10-29 13:12   
Hello Lucía,

Can you please attach the modified report that you used to reproduce the issue?
(0132768)
lbressan   
2021-11-01 15:21   
Hi Augusto,

The client has modified two things, here I attach:
He comentado una linea y añadido otra linea a la clase org.openbravo.client.application.report.ReportFiller que contiene el método:

JasperPrint fillReport() throws JRException {
JasperPrint jasperPrint;
long t1 = System.currentTimeMillis();
if (connectionProvider == null) {
// jasperPrint = fill(OBDal.getReadOnlyInstance().getConnection()); -> Esto es lo que hay y lo he comentado y he añadido la clase siguiente y ha funcionado en varios procesos.
jasperPrint = fill(OBDal.getInstance().getConnection());
} else {
jasperPrint = fill();
}
log.debug("Report {} filled in {} ms", jasperReport.getName(),
(System.currentTimeMillis() - t1));
return jasperPrint;
}

El cambio basicamente ha sido pasar de OBDal.getReadOnlyInstance().getConnection() a OBDal.getInstance().getConnection() y ha funcionado en 2 de los 3 reports que estaban dando error.

He has also modified the core:
Fichero org.openbravo.client.application.report.ReportFiller
-> Hemos dejado así el método fillReport()
JasperPrint fillReport() throws JRException {
JasperPrint jasperPrint;
long t1 = System.currentTimeMillis();
if (connectionProvider == null) {
//Inicio Cambio
// jasperPrint = fill(OBDal.getReadOnlyInstance().getConnection());
jasperPrint = fill(OBDal.getInstance().getConnection());
//Fin Cambio
} else {
jasperPrint = fill();
}
log.debug("Report {} filled in {} ms", jasperReport.getName(),
(System.currentTimeMillis() - t1));
return jasperPrint;
}

· Fichero org.openbravo.erpCommon.utility.Utility
Hemos dejado así el método showImageLogo
public static BufferedImage showImageLogo(String logo, String org) throws IOException {
// Same as showImage(id), using getImageLogo(id, org, true) to close the DAL connection once the
// image has been retrieved.
// This is required to avoid connection leaks when invoking this method from a sub-report.
// This is needed until issue https://issues.openbravo.com/view.php?id=30182 [^] is fixed.
//Inicio cambio EXOS
// return ImageIO.read(new ByteArrayInputStream(getImageLogo(logo, org, true)));
return ImageIO.read(new ByteArrayInputStream(getImageLogo(logo, org, false)));
//Fin cambio EXOS
}

También aquí cambiamos la función getImageLogoObject añadiendo un else-if más
//Cambio EXOS
else if ("jover-logo".equals(logo)) {
if (org != null && !org.equals("")) {
Organization organization = OBDal.getReadOnlyInstance().get(Organization.class, org);
img = organization.getObmdImage(); //campo nuevo donde almacenamos una nueva imagen para la org.
}

}

Y por último modificamos la parte del jrxml donde se llama a la función de la imagen para realizar esta llamada
org.openbravo.erpCommon.utility.Utility.showImageLogo("jover-logo", $F{organizationid})
(0133152)
dromero   
2021-11-17 14:18   
any update?
(0133330)
dromero   
2021-11-24 16:45   
any update?
(0133374)
cberner   
2021-11-25 17:18   
(edited on: 2021-11-25 17:20)
Hello, I've been trying to reproduce this issue, but I was not able to do it.
I've tested with this C_OrderLinesJR_new.jrxml modified file: https://gitlab.com/-/snippets/2212176 [^] , it only adds a new image at the end, using showImageLogo API.

This seems to work fine on both reports and subreports. I didn't apply the modifications that were mentioned in the previous note(these are customer customizations and shouldn't be necessary to fix the repo).

Could you provide a report that fails so we can reproduce the issue? The one I prepared with an image works perfectly fine.
I've tested both in 21Q2.3 and in master, in both it seems to work correctly.

(0144672)
AugustoMauch   
2022-12-14 12:54   
Closing this issue after 1 year of inactivity