users@jersey.java.net

RE: Jersey EJB exception

From: Herak Sen <HSen_at_vertrax.com>
Date: Mon, 27 Jul 2009 10:30:28 -0400

Hello,

The bigger problem that I see here is that to use EJB in a resource class(a common use case) one has to make it an EJB too.
e.g.
@Stateless
@Path("/testrs")
public class TestResource{
   private @ EJB MyEJB myEJB;
}
If TestResource is not an EJB then myEJB is not injected and is null.
On the other if TestResource was not an EJB and myEJB was injected correctly then I think throwing WebApplicationException will be caught by Jersey

Herak

From: Herak Sen
Sent: Thursday, July 23, 2009 11:31 AM
To: 'users_at_jersey.dev.java.net'
Subject: Jersey EJB exception

Hi,

when I throw WebApplicationException from resource class, it's always caught as EJBException, thus the client get wrong http error code (500).

@Stateless
@Path("/testrs")
public class TestResource{

   @GET
    public void throwExc(){

      throw new WebApplicationException();

  }
}

I guess this should not be the expected behavior.

Thanks
Herak