Quantcast
Viewing all articles
Browse latest Browse all 3131

Jersey WebApplicationException problem with HANA Cloud

Hi,

 

I've got HANA Cloud working with Jersey 1.17, however I wanted to change the default behaviour so that when the resource is not found that a 404 is returned rather than a 204 (No Content).

 

To do this, I just do a simple null check and throw Jersey's WebApplicationException as a 404.

 

    @GET    @Path("{id}")    public Organisation getOrganisation(@PathParam("id") Long id) {                   Organisation org = orgBean.getOrganisation(id);                      if (org == null) {            throw new WebApplicationException(404);              } else {                        return org;              }    }

 

When run under Glassfish 3.1 (with Jersey 1.17), this works fine.  The HTTP status code is 404.  However when I run with SAP HANA Cloud, either local or remote, I get an HTTP 500 instead, with the body being a HTML page containing the runtime exception report with "javax.ejb.EJBException: The bean encountered a non-application exception".

 

Note that my Jersey resource class is also a managed bean, so that injection of the EJB data access object (that wraps my JPA entity) is supported.

 

Has anyone had success raising Jersey exceptions with HANA Cloud?

 

Kind regards,

Scott


Viewing all articles
Browse latest Browse all 3131

Trending Articles