Bug 1109153 - Application Exception information is lost during propagation back to the client
Summary: Application Exception information is lost during propagation back to the client
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: EJB
Version: 6.2.1
Hardware: Unspecified
OS: Unspecified
unspecified
urgent
Target Milestone: DR3
: EAP 6.4.0
Assignee: David M. Lloyd
QA Contact: Jan Martiska
URL: https://c.na7.visual.force.com/apex/C...
Whiteboard:
Depends On:
Blocks: 1140705
TreeView+ depends on / blocked
 
Reported: 2014-06-13 11:00 UTC by Shaun Appleton
Modified: 2021-06-10 10:44 UTC (History)
4 users (show)

Fixed In Version:
Clone Of:
: 1140705 (view as bug list)
Environment:
Last Closed:
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker WFLY-3600 0 Major Open TransactionRolledbackException doesn't reference the originating runtime-exception 2017-03-03 11:35:20 UTC

Description Shaun Appleton 2014-06-13 11:00:56 UTC
Background: Migrating an application from EAP 4 to EAP 6

Description of problem:

In EAP 4 JBossTransactionRolledbackException was used. This no longer exists in 6 so TransactionRolledbackException is now used.


When using EAP 6.2 a client receives the TransactionRolledbackException but is is stripped of the underlying issue that caused the exception.



Debugging shows a custom ProcessException is thrown initially on the EJB side (in the business classes), but it is not propagated to the client calling the EJB. Hence the application at the end is not able to show the error message.

Further debugging points to where the message is lost -
In EAP 6 :
- ProcessException is raised in a business class called by the EJB 
- the class AtomicAction(TwoPhaseCoordinator).beforeCompletion : the ProcessException is passed to the calling classes
- the class TransactionImple.commitAndDissociate : raises a rollbackException with ProcessException as cause
- CMTorg.jboss.as.ejb3.tx.CMTTxInterceptor : raises javax.ejb.EJBTransactionRolledbackException with RolbackException as cause ,  which has ProcessException as cause

This exception arrives in the class org.jboss.as.ejb3.component.interceptors.EjbExceptionTransformingInterceptorFactories where at line 69 a new TransactionRolledbackException is thrown with only the message :
            } catch (EJBTransactionRolledbackException e) {
                throw new TransactionRolledbackException(e.getMessage());
            }
starting from this point the exception propagated is a TransactionRolledbackException that has no cause .. 


org.jboss.as.ejb3.component.interceptors.EjbExceptionTransformingInterceptorFactories[1] has the following comments in it

053     /**
054      * We need to return a CreateException to the client.
055      * <p/>
056      * Rather than forcing all create exceptions everywhere to propagate, and generally making a mess, we stash
057      * the exception here, and then re-throw it from the exception transforming interceptor.
058      */

So it looks like a conscious design decision not to propagate the exception (and the cause) was made when it was written.

Note AS7-5432[2] was raised to enable propagation for the local case.
Can the remote case be fixed as well.


[1] http://grepcode.com/file/repository.jboss.org/nexus/content/repositories/releases/org.jboss.as/jboss-as-ejb3/7.1.0.CR1b/org/jboss/as/ejb3/component/interceptors/EjbExceptionTransformingInterceptorFactories.java
[2] https://issues.jboss.org/browse/AS7-5432

Comment 1 wfink 2014-07-07 10:20:56 UTC
From my point of view it is worth to have such business Exceptions as cause at the client side.
1) the customer is able to react on such business related problems
2) will be easier to find the root cause at the client without searching a lot within server logfile specially in cluster environments

Comment 3 Kabir Khan 2014-09-26 12:02:35 UTC
https://github.com/jbossas/jboss-eap/pull/1705

Comment 4 Jan Martiska 2014-10-01 08:28:44 UTC
This fix introduced a regression (https://bugzilla.redhat.com/show_bug.cgi?id=1148015) - the regression will be fixed via that bugzilla. Pushing this one to verified @EAP 6.4.0.DR3.


Note You need to log in before you can comment on or make changes to this bug.