|
From: Adam J. <Ada...@ge...> - 2008-07-09 01:01:04
|
Here¹s the situation.
I¹ve got a resource implemented as a Stateless EJB (exposed via a Seam
application but that¹s neither here nor there).
@Stateless
@Local(SpecimensClient.class)
@Name("specimens")
@Path("/rest/specimens")
public class SpecimensBean implements SpecimensClient, Serializable
{
public ExtSpecimen getSpecimen(Long id)
{
try
{
Specimen specimen = (Specimen)
em.createQuery("XYZ").getSingleResult();
...
return extSpecimen;
}
catch (NoResultException e)
{
throw new
WebApplicationException(HttpURLConnection.HTTP_NOT_FOUND);
}
}
}
Now accessing that resource with an invalid id is resulting in the
WebApplicationException getting thrown. However instead of it propagating
up as a InvocationTargetException with the WebApplicationException as it¹s
cause, the InvocationTargetException is wrapping an EJBException which in
turn is wrapping the WebApplicationException.
What¹s the opinion on the best way to handle this, short of having to
implement a @Provider to do the unwrapping of the EJBException myself (which
does seem to work).
Kind Regards,
Adam
|