[Jersey] 204 status returned instead of 500 when throwing WebApplicationException

From: <>
Date: Wed, 1 Feb 2012 18:04:12 +0000 (GMT)

I have a Jersey web service with the following a resource class:

    public class ProvisionResource
        private final Logger logger =
        private ProvisionService provisionService;
        public SubscriberAccount querySubscriberAccount(
                @QueryParam("accountNum") String accountNum)
            logger.debug("Entering querySubscriberAccount()");
            final SubscriberAccount account;
                account = provisionService.querySubscriber(accountNum);
                if (account != null)
                    logger.debug("Retreived account = " + account);
                    logger.debug("No account was found for " +
            catch (IllegalArgumentException ex)
                logger.error("Illegal argument while executing query
for subscriber account",
                throw new
            catch (Exception ex)
                logger.error("Unexpected exception while executing
query for subscriber account",
                throw new
            logger.debug("Exiting querySubscriberAccount()");
            return account;

    .... snip ....

The `provisionService.querySubscriber` throws an exception which is
caught by the second catch statement in the `querySubscriberAccount`
method (we see the log statement in the file). However, the client is
receiving a `204` status instead of the expected `500` error.

I did find this issue which is similar to mine: but is quite old and for Jersey
1.3.1. We are using version 1.9.1.

Has anyone else seen this issue and hopefully figured out what the
problem is?