我有一个泽西岛网络服务,其中包含以下资源类:
@Stateless
@Path("/provision")
public class ProvisionResource
{
private final Logger logger = LoggerFactory.getLogger(ProvisionResource.class);
@EJB
private ProvisionService provisionService;
@GET
@Produces(MediaType.APPLICATION_XML)
@Path("/subscriber")
public SubscriberAccount querySubscriberAccount(
@QueryParam("accountNum") String accountNum)
{
logger.debug("Entering querySubscriberAccount()");
final SubscriberAccount account;
try
{
account = provisionService.querySubscriber(accountNum);
if (account != null)
{
logger.debug("Retreived account = " + account);
}
else
{
logger.debug("No account was found for " + accountNum);
}
}
catch (IllegalArgumentException ex)
{
logger.error("Illegal argument while executing query for subscriber account",
ex);
throw new WebApplicationException(Response.Status.BAD_REQUEST);
}
catch (Exception ex)
{
logger.error("Unexpected exception while executing query for subscriber account",
ex);
throw new WebApplicationException(Response.Status.INTERNAL_SERVER_ERROR);
}
logger.debug("Exiting querySubscriberAccount()");
return account;
}
.... snip ....
}
provisionService.querySubscriber
抛出一个异常,该异常由querySubscriberAccount
方法中的第二个catch语句捕获(我们在文件中看到了log语句)。但是,客户端收到204
状态而不是预期的500
错误。
我确实发现了这个类似于我的问题:http://java.net/jira/browse/JERSEY-41但是对于Jersey 1.3.1而言已经很老了。我们使用的是版本1.9.1。
是否有其他人看过这个问题并希望找出问题所在?