You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@deltaspike.apache.org by Rainer Schön <ra...@gmail.com> on 2014/07/29 14:58:02 UTC

DS SecurityInterceptor with DS ExceptionHandler in an ear deployment

Hello

I am using a DS SecurityInterceptor in both modules (ejb and war) and one DS ExceptionHandler in the web module. Since [DELTASPIKE-449] is closed, security violations integrate with DS exception handling. Now my problem: If a security violation in the ejb module is detected, DS does not find the ExceptionHandler in the web module. Instead of an AccessDeniedException I get an IllegalStateException in the web layer:

Could not find beans for Type=class xx.xxxxx.FacesExceptionHandler and qualifiers:[]  [1]

org.apache.deltaspike.core.api.provider.BeanProvider.getContextualReference(BeanProvider.java:150)
org.apache.deltaspike.core.api.provider.BeanProvider.getContextualReference(BeanProvider.java:119)
org.apache.deltaspike.core.api.provider.BeanProvider.getContextualReference(BeanProvider.java:100)
org.apache.deltaspike.core.impl.exception.control.HandlerMethodImpl.notify(HandlerMethodImpl.java:194)
org.apache.deltaspike.core.impl.exception.control.ExceptionHandlerBroadcaster.executeHandlers(ExceptionHandlerBroadcaster.java:153)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
... more

Within the web module, the exception handler works fine. Any regular CDI events thrown in the ejb module are delivered to listeners in the web module without any problem.

My workaround for  the moment is an ExceptionHandler in the ejb module catching the AccessDeniedException, mark the event as handled, extract the original event and throw it manually. Throwing it again with any of the ExceptionEvent throwing methods results in the same error as described above.

The error is reproducible easily. My configuration is GF4 and DS 1.0.0.

Any better ideas?

Regards, Rainer

[1]
@RequestScoped
@ExceptionHandler
public class FacesExceptionHandler {
...

Re: DS SecurityInterceptor with DS ExceptionHandler in an ear deployment

Posted by Jason Porter <li...@gmail.com>.
Sounds like an isolation problem between the EJB module and the web module.
Off the top if my head I can think of nothing else besides what you're
doing to fix that.

On Tuesday, July 29, 2014, Rainer Schön <ra...@gmail.com> wrote:

> Hello
>
> I am using a DS SecurityInterceptor in both modules (ejb and war) and one
> DS ExceptionHandler in the web module. Since [DELTASPIKE-449] is closed,
> security violations integrate with DS exception handling. Now my problem:
> If a security violation in the ejb module is detected, DS does not find the
> ExceptionHandler in the web module. Instead of an AccessDeniedException I
> get an IllegalStateException in the web layer:
>
> Could not find beans for Type=class xx.xxxxx.FacesExceptionHandler and
> qualifiers:[]  [1]
>
> org.apache.deltaspike.core.api.provider.BeanProvider.
> getContextualReference(BeanProvider.java:150)
> org.apache.deltaspike.core.api.provider.BeanProvider.
> getContextualReference(BeanProvider.java:119)
> org.apache.deltaspike.core.api.provider.BeanProvider.
> getContextualReference(BeanProvider.java:100)
> org.apache.deltaspike.core.impl.exception.control.
> HandlerMethodImpl.notify(HandlerMethodImpl.java:194)
> org.apache.deltaspike.core.impl.exception.control.
> ExceptionHandlerBroadcaster.executeHandlers(ExceptionHandlerBroadcaster.
> java:153)
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> ... more
>
> Within the web module, the exception handler works fine. Any regular CDI
> events thrown in the ejb module are delivered to listeners in the web
> module without any problem.
>
> My workaround for  the moment is an ExceptionHandler in the ejb module
> catching the AccessDeniedException, mark the event as handled, extract the
> original event and throw it manually. Throwing it again with any of the
> ExceptionEvent throwing methods results in the same error as described
> above.
>
> The error is reproducible easily. My configuration is GF4 and DS 1.0.0.
>
> Any better ideas?
>
> Regards, Rainer
>
> [1]
> @RequestScoped
> @ExceptionHandler
> public class FacesExceptionHandler {
> ...
>


-- 
Jason Porter
http://en.gravatar.com/lightguardjp