You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Falko Modler (JIRA)" <ji...@apache.org> on 2009/07/16 01:05:15 UTC

[jira] Created: (OPENEJB-1052) Undeclared @ApplicationException annotated RuntimeExceptions are always wrapped in EJBExceptions

Undeclared @ApplicationException annotated RuntimeExceptions are always wrapped in EJBExceptions
------------------------------------------------------------------------------------------------

                 Key: OPENEJB-1052
                 URL: https://issues.apache.org/jira/browse/OPENEJB-1052
             Project: OpenEJB
          Issue Type: Bug
    Affects Versions: 3.1.1
         Environment: Windows XP, Java 1.6, Maven 2.0.9
            Reporter: Falko Modler


RuntimeExceptions that are annotated with @javax.ejb.ApplicationException are only handled as application exceptions when they are declared by the EJB method (or by an Interceptor AroundInvoke method).

When such an annotated exception is NOT declared by the "throwing method", it get's wrapped into an EJBException - with all the consequences (EJB will be discarded, transaction will be rolled back)!

Example:

@javax.ejb.ApplicationException(rollback=false)
public class SomeApplicationException extends RuntimeException { ...

Given an EJB method someEJBMethod that throws SomeApplicationException; this will prevent SomeApplicationException to be wrapped in an EJBException:

public void someEJBMethod(...) throws SomeApplicationException { ...

But this will not work (SomeApplicationException will be wrapped):

public void someEJBMethod(...) { ...


In contrast: JBOSS 4.2.3 always evaluates @javax.ejb.ApplicationException, not just for declared exceptions! This is what I expect openejb to do as well...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (OPENEJB-1052) Undeclared @ApplicationException annotated RuntimeExceptions from non-ejb libraries are always wrapped in EJBExceptions

Posted by "Falko Modler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/OPENEJB-1052?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Falko Modler updated OPENEJB-1052:
----------------------------------

    Description: 
RuntimeExceptions that are annotated with @javax.ejb.ApplicationException are only handled as application exceptions when they are declared by the EJB method (or by an Interceptor AroundInvoke method).

When such an annotated exception is NOT declared by the "throwing method", it get's wrapped into an EJBException - with all the consequences (EJB will be discarded, transaction will be rolled back)!

Example:

@javax.ejb.ApplicationException(rollback=false)
public class SomeApplicationException extends RuntimeException { ...

Given an EJB method someEJBMethod that throws SomeApplicationException; this will prevent SomeApplicationException to be wrapped in an EJBException:

public void someEJBMethod(...) throws SomeApplicationException { ...

But this will not work (SomeApplicationException will be wrapped):

public void someEJBMethod(...) { ...

This seems to happen only if the respective Exceptions is NOT bundled with the EJB it is thrown by!
e.g.:
A maven project using openejb to test some EJB from the current project which throws an @ApplicationException annotated RuntimeException that is packed in an "external" dependency/module.


In contrast: JBOSS 4.2.3 always evaluates @javax.ejb.ApplicationException, not just for declared exceptions! This is what I expect openejb to do as well...


  was:
RuntimeExceptions that are annotated with @javax.ejb.ApplicationException are only handled as application exceptions when they are declared by the EJB method (or by an Interceptor AroundInvoke method).

When such an annotated exception is NOT declared by the "throwing method", it get's wrapped into an EJBException - with all the consequences (EJB will be discarded, transaction will be rolled back)!

Example:

@javax.ejb.ApplicationException(rollback=false)
public class SomeApplicationException extends RuntimeException { ...

Given an EJB method someEJBMethod that throws SomeApplicationException; this will prevent SomeApplicationException to be wrapped in an EJBException:

public void someEJBMethod(...) throws SomeApplicationException { ...

But this will not work (SomeApplicationException will be wrapped):

public void someEJBMethod(...) { ...


In contrast: JBOSS 4.2.3 always evaluates @javax.ejb.ApplicationException, not just for declared exceptions! This is what I expect openejb to do as well...

        Summary: Undeclared @ApplicationException annotated RuntimeExceptions from non-ejb libraries are always wrapped in EJBExceptions  (was: Undeclared @ApplicationException annotated RuntimeExceptions are always wrapped in EJBExceptions)

Added restriction regarding "from non-ejb libraries".

> Undeclared @ApplicationException annotated RuntimeExceptions from non-ejb libraries are always wrapped in EJBExceptions
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: OPENEJB-1052
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1052
>             Project: OpenEJB
>          Issue Type: Bug
>    Affects Versions: 3.1.1
>         Environment: Windows XP, Java 1.6, Maven 2.0.9
>            Reporter: Falko Modler
>
> RuntimeExceptions that are annotated with @javax.ejb.ApplicationException are only handled as application exceptions when they are declared by the EJB method (or by an Interceptor AroundInvoke method).
> When such an annotated exception is NOT declared by the "throwing method", it get's wrapped into an EJBException - with all the consequences (EJB will be discarded, transaction will be rolled back)!
> Example:
> @javax.ejb.ApplicationException(rollback=false)
> public class SomeApplicationException extends RuntimeException { ...
> Given an EJB method someEJBMethod that throws SomeApplicationException; this will prevent SomeApplicationException to be wrapped in an EJBException:
> public void someEJBMethod(...) throws SomeApplicationException { ...
> But this will not work (SomeApplicationException will be wrapped):
> public void someEJBMethod(...) { ...
> This seems to happen only if the respective Exceptions is NOT bundled with the EJB it is thrown by!
> e.g.:
> A maven project using openejb to test some EJB from the current project which throws an @ApplicationException annotated RuntimeException that is packed in an "external" dependency/module.
> In contrast: JBOSS 4.2.3 always evaluates @javax.ejb.ApplicationException, not just for declared exceptions! This is what I expect openejb to do as well...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.