users@jersey.java.net

Re: [Jersey] EJBException throwed when using WebApplicationException

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Thu, 18 Mar 2010 08:56:38 +0100

Hi Youri,

Cross posting to the GF users list as Jersey does not log such an
exception and i presume it is the EJB container that is logging.

Paul.

On Mar 17, 2010, at 5:49 PM, Youri Bonnaffé Compte wrote:

> Hi,
>
> I'm using a Jersey Rest service and dependency injection on
> Glassfish v3. When a WebApplicationException is thrown, it is
> correctly handled as I can see the correct error page on my browser
> (I'm using HTTP status code). The problem is that an EJBException is
> also raised and appears in the server's log.
>
>
> WARNING: A system exception occurred during an invocation on EJB
> AuthenticateRS method public
> fr.insa.lyon.ot.sims.centralserver.ws.response.AuthenticateResponse
> fr
> .insa
> .lyon
> .ot
> .sims
> .centralserver
> .ws.AuthenticateRS.authenticate(java.lang.String,java.lang.String)
> javax.ejb.EJBException
> at
> com
> .sun
> .ejb
> .containers.BaseContainer.processSystemException(BaseContainer.java:
> 5070)
> ....... (continues.....) ....
> Caused by: javax.ws.rs.WebApplicationException
> at
> fr
> .insa
> .lyon
> .ot
> .sims
> .centralserver.ws.AuthenticateRS.authenticate(AuthenticateRS.java:35)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun
> .reflect
> .NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> ....
>
> The service is annotated as follow :
>
> @Path("/authenticate")
> @Stateless
> public class AuthenticateRS { .....
>
> It is actually a lot of output and it doesn't help to debug other
> issues :/.
> It is quite disturbing as HTTP status code are commonly used with
> Rest services (as far as I know...).
> Is there a way to avoid such exception to be thrown or to control
> the logging of such exceptions ?
>
> Thanks for your help.