shawnjohnson
shawnjohnson

Reputation: 405

RESTEasy - Stacktrace in logs when throwing WebApplicationException

I am using Resteasy 2.3.3, bundled with JBoss-AS-7.1.3. I'm trying to throw a new WebAppliationException, and the output (to the client) seems fine, but I'm left with an unwanted stack trace in my log. I have a few other Exceptions mapped, and I was wondering if the mapping was somehow causing an issue ­ trying to wrap this Exception.

Simple example:

public class SimpleService {
@GET
@Path("stuff")
public String getStuff(final @QueryParam("param1") String param1,
  @QueryParam("param2") String param2) throws ActionException {
  if (param1==null && param2==null) {
    throw new WebApplicationException();
  }

I get the following exception:

[WARN] org.jboss.resteasy.core.SynchronousDispatcher#error - failed to execute: javax.ws.rs.WebApplicationException

Any ideas what this error might mean? How I could get rid of the messages?

Upvotes: 1

Views: 1558

Answers (1)

shawnjohnson
shawnjohnson

Reputation: 405

I stumbled across another class in the javadoc - NoLogWebApplicationException, and it says:

WebApplicationExceptions are logged by RESTEasy. Use this exception when you don't want your exception logged

https://docs.jboss.org/resteasy/docs/2.3.3.Final/javadocs/org/jboss/resteasy/spi/NoLogWebApplicationException.html

Upvotes: 2

Related Questions