users@jersey.java.net

EJBException throwed when using WebApplicationException

From: Youri Bonnaffé Compte <youricompte_at_gmail.com>
Date: Wed, 17 Mar 2010 17:49:59 +0100

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.