Project:
View Issue Details[ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
ID | ||||||||
0030813 | ||||||||
Type | Category | Severity | Reproducibility | Date Submitted | Last Update | |||
defect | [Openbravo ERP] A. Platform | minor | have not tried | 2015-09-11 11:01 | 2015-11-28 15:24 | |||
Reporter | mtaal | View Status | public | |||||
Assigned To | caristu | |||||||
Priority | urgent | Resolution | fixed | Fixed in Version | 3.0PR16Q1 | |||
Status | closed | Fix in branch | Fixed in SCM revision | cdba0d010a46 | ||||
Projection | none | ETA | none | Target Version | 3.0PR16Q1 | |||
OS | Any | Database | Any | Java version | ||||
OS Version | Database version | Ant version | ||||||
Product Version | SCM revision | |||||||
Merge Request Status | ||||||||
Review Assigned To | mtaal | |||||||
OBNetwork customer | No | |||||||
Web browser | ||||||||
Modules | Core | |||||||
Support ticket | ||||||||
Regression level | ||||||||
Regression date | ||||||||
Regression introduced in release | ||||||||
Regression introduced by commit | ||||||||
Triggers an Emergency Pack | No | |||||||
Summary | 0030813: Show content of batch exception when it happens in requestfilter commitandclose | |||||||
Description | See stack trace below, it is a BatchUpdateException which hides the real cause. SEVERE: Servlet.service() for servlet P43ADA4F09EAD4034A8F9B1F4759407B5 threw exception org.hibernate.exception.GenericJDBCException: could not insert: [obmobc_logclient] at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:140) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:128) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2454) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2868) at org.hibernate.action.EntityInsertAction.execute(EntityInsertAction.java:79) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:273) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:265) at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:184) at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321) at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:51) at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1216) at org.openbravo.dal.service.OBDal.flush(OBDal.java:205) at org.openbravo.dal.core.SessionHandler.flushRemainingChanges(SessionHandler.java:322) at org.openbravo.dal.core.SessionHandler.commitAndClose(SessionHandler.java:265) at org.openbravo.dal.core.DalThreadHandler.doFinal(DalThreadHandler.java:51) at org.openbravo.dal.core.DalRequestFilter$1.doFinal(DalRequestFilter.java:99) at org.openbravo.dal.core.ThreadHandler.run(ThreadHandler.java:65) at org.openbravo.dal.core.DalRequestFilter.doFilter(DalRequestFilter.java:103) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489) at java.lang.Thread.run(Thread.java:745) Caused by: java.sql.BatchUpdateException: Batch entry 0 insert into obmobc_logclient (AD_Client_ID, AD_Org_ID, Isactive, Created, Createdby, Updated, Updatedby, Json, Deviceid, Msg, Loglevel, Obmobc_Logclient_ID) values ('39363B0921BB4293B48383844325E84C', 'D270A5AC50874F8BA67A88EE977F8E3B', 'Y', '2015-09-11 10:27:50.415000 +02:00:00', '3073EDF96A3C42CC86C7069E379522D2', '2015-09-11 10:29:13.231000 +02:00:00', '3073EDF96A3C42CC86C7069E379522D2', '{"obmobc_logclient_id":"0DFAFCFF540A7BA1D78ED057D5F42F11","created":1441960070415,"createdby":"3073EDF96A3C42CC86C7069E379522D2","loglevel":"Info","msg":"Ticket closed: ; Id: 0903864A37A373207E6ECFEADE3D9513. Docno: VBS1/0000175. Total gross: 18.9. Lines: [{Product: Headlamp ultralight, Quantity: 1 Gross: 18.9}] Payments: [{PaymentMethod: OBPOS_payment.cash, Amount: 18.9 OrigAmount: 18.9 Date: Fri Sep 11 2015 10:27:50 GMT+0200 (CEST) isocode: EUR}]; caller: http://localhost:8080/openbravo//web/js/gen/83a5e70ef154e77958df3d1e05daca0c_WebPOS.js:34858:17; [^] stackTrace: Object.<anonymous> (http://localhost:8080/openbravo//web/js/gen/83a5e70ef154e77958df3d1e05daca0c_WebPOS.js:26538:10 [^])","deviceId":"VBS-1","link":"http://localhost:8080/openbravo//web/js/gen/83a5e70ef154e77958df3d1e05daca0c_WebPOS.js:9261:5","online":true}', [^] 'VBS-1', 'Ticket closed: ; Id: 0903864A37A373207E6ECFEADE3D9513. Docno: VBS1/0000175. Total gross: 18.9. Lines: [{Product: Headlamp ultralight, Quantity: 1 Gross: 18.9}] Payments: [{PaymentMethod: OBPOS_payment.cash, Amount: 18.9 OrigAmount: 18.9 Date: Fri Sep 11 2015 10:27:50 GMT+0200 (CEST) isocode: EUR}]; caller: http://localhost:8080/openbravo//web/js/gen/83a5e70ef154e77958df3d1e05daca0c_WebPOS.js:34858:17; [^] stackTrace: Object.<anonymous> (http://localhost:8080/openbravo//web/js/gen/83a5e70ef154e77958df3d1e05daca0c_WebPOS.js:26538:10 [^])', 'Info', 'ADB4F3D7604ABD55E2AD967EABF1AB23') was aborted. Call getNextException to see the cause. at org.postgresql.jdbc2.AbstractJdbc2Statement$BatchResultHandler.handleError(AbstractJdbc2Statement.java:2762) at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1999) at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:421) at org.postgresql.jdbc2.AbstractJdbc2Statement.executeBatch(AbstractJdbc2Statement.java:2929) at org.hibernate.jdbc.BatchingBatcher.doExecuteBatch(BatchingBatcher.java:70) at org.hibernate.jdbc.BatchingBatcher.addToBatch(BatchingBatcher.java:56) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2434) ... 27 more | |||||||
Steps To Reproduce | This exception is difficult to reproduce so I propose to force an exception in the code when testing the issue. | |||||||
Proposed Solution | rethrow as an OBException with the original cause which can be found in the getNextException call. | |||||||
Tags | No tags attached. | |||||||
Attached Files | ![]() ![]() ![]() | |||||||
![]() |
|||||||||
|
![]() |
|
(0081774) caristu (viewer) 2015-11-12 18:51 |
Attached a possible patch. |
(0081798) mtaal (viewer) 2015-11-12 21:47 |
the patch looks good to me. If you push and set the issue to resolved then I can close the issue, will test it then also. |
(0081945) hgbot (developer) 2015-11-18 12:58 |
Repository: erp/devel/pi Changeset: cdba0d010a468746a5f1f93d54fa26b88bc8258c Author: Carlos Aristu <carlos.aristu <at> openbravo.com> Date: Wed Nov 18 12:57:36 2015 +0100 URL: http://code.openbravo.com/erp/devel/pi/rev/cdba0d010a468746a5f1f93d54fa26b88bc8258c [^] fixes issue 30813: Show batch exception cause in SessionHandler commitAndClose A new method, getCausingException(Throwable t), has been created in OBException to recover the underlying exception of a BatchUpdateException. This method is used in the commitAndClose() method of SessionHandler class to solve this issue. Together with this, this new method is now used when instantating OBException with this constructor: OBException(Throwable cause) in order to retrieve the underlying exception information in this case also. --- M src/org/openbravo/base/exception/OBException.java M src/org/openbravo/dal/core/SessionHandler.java --- |
(0081946) caristu (viewer) 2015-11-18 13:01 |
Attached two files: - withgetCausingException.txt : shows the stack trace using the new getCausingException() method. - withoutgetCausingException.txt : shows the stack trace without using the new getCausingException() method. This is an example that shows a similar case about how the stack trace was printed on SessionHandler before solving the issue. |
(0081970) mtaal (viewer) 2015-11-19 10:27 |
I found several places in the code were we try to resolve batchupdateexception... I propose to resolve all of them to use one common utility method. I found a special version of the utility method in DbUtility.getUnderlyingSQLException (it also seems to cover other cases) maybe you can re-use that one instead of using the new one (which can then be removed to not make the public api bigger). So I propose: - make one utility method which finds the underlying connection (maybe DbUtility.getUnderlyingException is already good) - let all the places where we try to resolve the batchupdatexception use this utility method - deprecate all the other static utility methods and let them call the 'chosen-one' |
(0082014) hgbot (developer) 2015-11-20 11:21 |
Repository: erp/devel/pi Changeset: b8fb98f7e5f62834195ba0bb91e8b75611c5342a Author: Carlos Aristu <carlos.aristu <at> openbravo.com> Date: Fri Nov 20 09:00:28 2015 +0100 URL: http://code.openbravo.com/erp/devel/pi/rev/b8fb98f7e5f62834195ba0bb91e8b75611c5342a [^] related to issue 30813: use DbUtility.getUnderlyingSQLException() --- M modules/org.openbravo.advpaymentmngt/src/org/openbravo/advpaymentmngt/utility/FIN_Utility.java M modules/org.openbravo.service.json/src/org/openbravo/service/json/DefaultJsonDataService.java M modules/org.openbravo.service.json/src/org/openbravo/service/json/JsonUtils.java M src/org/openbravo/base/exception/OBException.java M src/org/openbravo/dal/core/SessionHandler.java M src/org/openbravo/service/db/DataImportService.java M src/org/openbravo/service/db/DbUtility.java M src/org/openbravo/service/importprocess/ImportProcessUtils.java --- |
(0082015) caristu (viewer) 2015-11-20 11:29 |
Updated wiki to inform about the getUnderlyingSQLException() method: http://wiki.openbravo.com/wiki/Common_Issues_Tips_and_Tricks#When_flushing.2Fcommitting_a_trigger_throws_an_exception.2C_but_I_can.27t_see.2Fdisplay_the_real_trigger_message [^] |
(0082045) mtaal (viewer) 2015-11-21 23:41 |
Reviewed |
(0082253) hudsonbot (viewer) 2015-11-23 21:17 |
A changeset related to this issue has been promoted main and to the Central Repository, after passing a series of tests. Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/7b56bebaaa88 [^] Maturity status: Test |
(0082258) hudsonbot (viewer) 2015-11-23 21:17 |
A changeset related to this issue has been promoted main and to the Central Repository, after passing a series of tests. Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/7b56bebaaa88 [^] Maturity status: Test |
(0082441) hgbot (developer) 2015-11-28 09:34 |
Repository: erp/devel/pi Changeset: 3c5bd06844f5103fcf16021d85baa7589b4c9781 Author: Martin Taal <martin.taal <at> openbravo.com> Date: Sat Nov 28 00:07:20 2015 +0100 URL: http://code.openbravo.com/erp/devel/pi/rev/3c5bd06844f5103fcf16021d85baa7589b4c9781 [^] Related to issue 30813: Show content of batch exception when it happens in requestfilter commitandclose Also log batchupdateexception in other constructor of OBException --- M src/org/openbravo/base/exception/OBException.java --- |
(0082453) hudsonbot (viewer) 2015-11-28 15:24 |
A changeset related to this issue has been promoted main and to the Central Repository, after passing a series of tests. Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/a30fd74371da [^] Maturity status: Test |
![]() |
|||
Date Modified | Username | Field | Change |
2015-09-11 11:01 | mtaal | New Issue | |
2015-09-11 11:01 | mtaal | Assigned To | => platform |
2015-09-11 11:01 | mtaal | OBNetwork customer | => No |
2015-09-11 11:01 | mtaal | Modules | => Core |
2015-09-11 11:01 | mtaal | Triggers an Emergency Pack | => No |
2015-09-29 12:29 | alostale | Target Version | 3.0PR15Q4 => 3.0PR16Q1 |
2015-11-06 11:00 | alostale | Status | new => acknowledged |
2015-11-11 11:33 | alostale | Priority | normal => urgent |
2015-11-12 18:50 | caristu | Assigned To | platform => caristu |
2015-11-12 18:50 | caristu | Status | acknowledged => scheduled |
2015-11-12 18:51 | caristu | Note Added: 0081774 | |
2015-11-12 18:51 | caristu | File Added: issue30813.diff | |
2015-11-12 21:47 | mtaal | Note Added: 0081798 | |
2015-11-12 21:49 | mtaal | Review Assigned To | => mtaal |
2015-11-18 12:58 | hgbot | Checkin | |
2015-11-18 12:58 | hgbot | Note Added: 0081945 | |
2015-11-18 12:58 | hgbot | Status | scheduled => resolved |
2015-11-18 12:58 | hgbot | Resolution | open => fixed |
2015-11-18 12:58 | hgbot | Fixed in SCM revision | => http://code.openbravo.com/erp/devel/pi/rev/cdba0d010a468746a5f1f93d54fa26b88bc8258c [^] |
2015-11-18 12:58 | caristu | Issue Monitored: alostale | |
2015-11-18 12:58 | caristu | File Added: withgetCausingException.txt | |
2015-11-18 12:59 | caristu | File Added: withoutgetCausingException.txt | |
2015-11-18 13:01 | caristu | Note Added: 0081946 | |
2015-11-19 10:27 | mtaal | Note Added: 0081970 | |
2015-11-19 10:27 | mtaal | Status | resolved => new |
2015-11-19 10:27 | mtaal | Resolution | fixed => open |
2015-11-20 10:38 | mtaal | Relationship added | related to 0031543 |
2015-11-20 11:21 | hgbot | Checkin | |
2015-11-20 11:21 | hgbot | Note Added: 0082014 | |
2015-11-20 11:28 | caristu | Status | new => scheduled |
2015-11-20 11:29 | caristu | Note Added: 0082015 | |
2015-11-20 11:29 | caristu | Status | scheduled => resolved |
2015-11-20 11:29 | caristu | Resolution | open => fixed |
2015-11-21 23:41 | mtaal | Note Added: 0082045 | |
2015-11-21 23:41 | mtaal | Status | resolved => closed |
2015-11-21 23:41 | mtaal | Fixed in Version | => 3.0PR16Q1 |
2015-11-23 21:17 | hudsonbot | Checkin | |
2015-11-23 21:17 | hudsonbot | Note Added: 0082253 | |
2015-11-23 21:17 | hudsonbot | Checkin | |
2015-11-23 21:17 | hudsonbot | Note Added: 0082258 | |
2015-11-28 09:34 | hgbot | Checkin | |
2015-11-28 09:34 | hgbot | Note Added: 0082441 | |
2015-11-28 15:24 | hudsonbot | Checkin | |
2015-11-28 15:24 | hudsonbot | Note Added: 0082453 |
Copyright © 2000 - 2009 MantisBT Group |