0 Replies Latest reply on May 8, 2007 12:04 PM by Spartak Nasto

    Custom error valve

    Spartak Nasto Newbie

      I have used an error report valve in Jboss 3.2.6 and want to make it work on 4.2.0 CR2.
      I am a beginer in Java and hope for your help.

      Here is the problem that I am facing:
      compilation error on Throwable
      snip code below:

      protected void report(Request request, Response response,
      Throwable throwable)
      throws IOException, ServletException
      {
      .............................................................
      # later in the code I catch the error code:

      try
      {
      try
      {
      hres.setContentType("text/html");
      hres.setCharacterEncoding("utf-8");
      }
      catch (Throwable t)
      {
      if (debug >= 1)
      log("status.setContentType", t);
      }



      ./compile.sh CustomErrorValve.java

      CustomErrorValve.java:97: report(org.apache.catalina.connector.Request,org.apache.catalina.connector.Response,java.l
      ang.Throwable) in CustomErrorValve cannot override report(org.apache.catalina.connector.Request,org.apache.catalina.
      connector.Response,java.lang.Throwable) in org.apache.catalina.valves.ErrorReportValve; overridden method does not t
      hrow javax.servlet.ServletException
      protected void report(Request request, Response response,
      ^
      CustomErrorValve.java:371: cannot find symbol
      symbol : method log(java.lang.String,java.lang.Throwable)
      location: class CustomErrorValve
      log("status.setContentType", t);
      ^
      2 errors