You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by nialscorva <ja...@tensorwrench.com> on 2013/10/12 15:53:19 UTC

Throwing ApplicationException from Interceptor wraps with annotation, works with ejb-jar.xml

I am writing a CDI interceptor that evaluates Apache Shiro annotations.  If
it fails, it throws a subclass of AuthorizationException or
AuthenticationException (both RuntimeExceptions) that is marked as an
@ApplicationException.

When testing with Tomee 1.5.2 under Arquillian, I've noticed that just if
the exception is annotated with @ApplicationException, it still wraps the
exception in an EJBException.  If I list the exceptions in
WEB-INF/ejb-jar.xml, it does not wrap it.

To replicate it using the code at https://github.com/TensorWrench/shiro-jee,
look at
src/test/java/com/tensorwrench/shiro/jee/SecuredInterceptorTest.java.  As
committed, the test runs.  If you remove the line:
  	      .addAsWebInfResource(new
StringAsset(ejbJar.exportAsString()),"ejb-jar.xml")
then all of the tests expecting an exception fail, since it will throw it
wrapped as an EJBException.

Probably related to https://issues.apache.org/jira/browse/OPENEJB-1052

Is this a bug or am I misunderstanding something?



--
View this message in context: http://openejb.979440.n4.nabble.com/Throwing-ApplicationException-from-Interceptor-wraps-with-annotation-works-with-ejb-jar-xml-tp4665562.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Throwing ApplicationException from Interceptor wraps with annotation, works with ejb-jar.xml

Posted by Romain Manni-Bucau <rm...@gmail.com>.
opened + fixed https://issues.apache.org/jira/browse/TOMEE-1057 but needs
to pass tck again to validate this behavior

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/10/12 Romain Manni-Bucau <rm...@gmail.com>

> Not sure that's linked but we'll have a look.
>
> BTW did you see https://issues.apache.org/jira/browse/SHIRO-337 ?
>
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> *Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> *Github: https://github.com/rmannibucau*
>
>
>
> 2013/10/12 nialscorva <ja...@tensorwrench.com>
>
>> I am writing a CDI interceptor that evaluates Apache Shiro annotations.
>>  If
>> it fails, it throws a subclass of AuthorizationException or
>> AuthenticationException (both RuntimeExceptions) that is marked as an
>> @ApplicationException.
>>
>> When testing with Tomee 1.5.2 under Arquillian, I've noticed that just if
>> the exception is annotated with @ApplicationException, it still wraps the
>> exception in an EJBException.  If I list the exceptions in
>> WEB-INF/ejb-jar.xml, it does not wrap it.
>>
>> To replicate it using the code at
>> https://github.com/TensorWrench/shiro-jee,
>> look at
>> src/test/java/com/tensorwrench/shiro/jee/SecuredInterceptorTest.java.  As
>> committed, the test runs.  If you remove the line:
>>               .addAsWebInfResource(new
>> StringAsset(ejbJar.exportAsString()),"ejb-jar.xml")
>> then all of the tests expecting an exception fail, since it will throw it
>> wrapped as an EJBException.
>>
>> Probably related to https://issues.apache.org/jira/browse/OPENEJB-1052
>>
>> Is this a bug or am I misunderstanding something?
>>
>>
>>
>> --
>> View this message in context:
>> http://openejb.979440.n4.nabble.com/Throwing-ApplicationException-from-Interceptor-wraps-with-annotation-works-with-ejb-jar-xml-tp4665562.html
>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>
>
>

Re: Throwing ApplicationException from Interceptor wraps with annotation, works with ejb-jar.xml

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Not sure that's linked but we'll have a look.

BTW did you see https://issues.apache.org/jira/browse/SHIRO-337 ?

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/10/12 nialscorva <ja...@tensorwrench.com>

> I am writing a CDI interceptor that evaluates Apache Shiro annotations.  If
> it fails, it throws a subclass of AuthorizationException or
> AuthenticationException (both RuntimeExceptions) that is marked as an
> @ApplicationException.
>
> When testing with Tomee 1.5.2 under Arquillian, I've noticed that just if
> the exception is annotated with @ApplicationException, it still wraps the
> exception in an EJBException.  If I list the exceptions in
> WEB-INF/ejb-jar.xml, it does not wrap it.
>
> To replicate it using the code at
> https://github.com/TensorWrench/shiro-jee,
> look at
> src/test/java/com/tensorwrench/shiro/jee/SecuredInterceptorTest.java.  As
> committed, the test runs.  If you remove the line:
>               .addAsWebInfResource(new
> StringAsset(ejbJar.exportAsString()),"ejb-jar.xml")
> then all of the tests expecting an exception fail, since it will throw it
> wrapped as an EJBException.
>
> Probably related to https://issues.apache.org/jira/browse/OPENEJB-1052
>
> Is this a bug or am I misunderstanding something?
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Throwing-ApplicationException-from-Interceptor-wraps-with-annotation-works-with-ejb-jar-xml-tp4665562.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>