Description
I guess this has been bugging me for a very long time, so I finally dug through it today and fixed it so that sometimes when a SECA service fails, all you get back is a
Service invocation error: (commit transaction failed)
and now it can display the full error message like this:
Error calling event: org.ofbiz.webapp.event.EventHandlerException: Service invocation error (Roll back error, could not commit transaction, was rolled back instead Service Error [postInvoiceToGl]: Cannot find posting GL account for invoice item [GenericEntity:InvoiceItem][amount,50000.0(java.lang.Double)][createdStamp,2006-11-28 14:19:15.065(java.sql.Timestamp)][createdTxStamp,2006-11-28 14:19:12.55(java.sql.Timestamp)][description,BIG-1 Server(java.lang.String)][inventoryItemId,null()][invoiceId,10160(java.lang.String)][invoiceItemSeqId,01(java.lang.String)][invoiceItemTypeId,PINV_FXASTPRD_ITEM(java.lang.String)][lastUpdatedStamp,2006-11-28 14:19:15.065(java.sql.Timestamp)][lastUpdatedTxStamp,2006-11-28 14:19:12.55(java.sql.Timestamp)][overrideGlAccountId,null()][parentInvoiceId,null()][parentInvoiceItemSeqId,null()][productFeatureId,null()][productId,SERVER1(java.lang.String)][quantity,1.0(java.lang.Double)][taxAuthGeoId,null()][taxAuthPartyId,null()][taxAuthorityRateSeqId,null()][taxableFlag,null()][uomId,null()] (null))
The problem it turns out is that TransactionUtil sets a rollback and then sets a RollbackOnlyCause in the setRollbackOnlyCause ThreadLocal variable, then when the commit tries to rollback, it was not checking for this RollbackOnlyCause. I added some code to check if this existed and if so, get the error message from it, and now it works.