You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Craig R. McClanahan" <cr...@apache.org> on 2002/08/05 21:26:15 UTC

Re: Tomcat4 and UnavailableException

I don't know if this is the only problem, but it's certainly not going to
work if you do not use the fully qualified name of the exception class
(javax.servlet.UnavailableException).

Craig


On 5 Aug 2002, Dominique Deleris wrote:

> Date: 05 Aug 2002 21:27:17 +0200
> From: Dominique Deleris <do...@bluewin.ch>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: tomcat-user-list <to...@jakarta.apache.org>
> Subject: Tomcat4 and UnavailableException
>
> Hello, list...
>
> I try to handle UnavailableException with a <error-page> tag in
> my web.xml:
>
>     <error-page>
>       <exception-type>UnavailableException</exception-type>
>       <location>/html/unavailable.html</location>
>     </error-page>
>
> As far as I know, it should work. However, Tomcat always treat
> this exception internally, displaying its own error page.
>
> When I raise another type of exception in the code
> (e.g. ServletException...) it will be handled correctly.
>
> Only UnavailableException does not work...
>
> Any idea ?
>
> --
> Dominique Deleris
> http://potatoworld.tuxfamily.org
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Tomcat4 and UnavailableException

Posted by Dominique Deleris <do...@bluewin.ch>.
On 06 Aug 2002 20:09:51 +0200, Dominique Deleris <do...@bluewin.ch> said:

 Dominique> protected void doGet(HttpServletRequest request,
 Dominique> HttpServletResponse response) throws ServletException,
 Dominique> IOException {
 Dominique> if (random.nextBoolean()) {
 Dominique> ...
 Dominique> throw new FreakServletException("Indisponibilité de doGet");
 Dominique> }
 Dominique> ...
 Dominique> }

Sorry,

This is the working example (FreakServletException inherits from
ServletException). The problem only occurs with :
throw new UnavailableException("Indisponibilité de doGet", 5);

-- 
Dominique Deleris
http://potatoworld.tuxfamily.org


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Tomcat4 and UnavailableException

Posted by Dominique Deleris <do...@bluewin.ch>.
On Mon, 5 Aug 2002 14:01:49 -0700 (PDT), "Craig R. McClanahan" <cr...@apache.org> said:

 Craig> The only other thing I can think of centers around where
 Craig> UnavailableException is being thrown.  If you're expecting to be able to
 Craig> catch an UnavailableException thrown by a servlet's init() method, that is
 Craig> not going to work -- it only works if the exception is thrown by the
 Craig> service() method (or, therefore, doGet() or doPut() on an HttpServlet).

The exception I want to catch this ways is thrown in a doGet()
method. Here is the code:

protected void doGet(HttpServletRequest request,
                       HttpServletResponse response) throws ServletException,
                       IOException {
    if (random.nextBoolean()) {
      ...
      throw new FreakServletException("Indisponibilité de doGet");
    }
    ...
}

-- 
Dominique Deleris
http://potatoworld.tuxfamily.org


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Tomcat4 and UnavailableException

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On 5 Aug 2002, Dominique Deleris wrote:

> Date: 05 Aug 2002 21:46:27 +0200
> From: Dominique Deleris <do...@bluewin.ch>
> Reply-To: Tomcat Users List <to...@jakarta.apache.org>
> To: Tomcat Users List <to...@jakarta.apache.org>
> Subject: Re: Tomcat4 and UnavailableException
>
>  Craig> I don't know if this is the only problem, but it's certainly not going to
>  Craig> work if you do not use the fully qualified name of the exception class
>  Craig> (javax.servlet.UnavailableException).
>
> No, unfortunately this does not change anything. I've even tried
> to subclass UnavailableException and providing the FQN, with no
> success.
>
> There seems to be a "problem" with the UnavailableException
> handling with Tomcat (at least 4). Or this is by design ?
>

The only other thing I can think of centers around where
UnavailableException is being thrown.  If you're expecting to be able to
catch an UnavailableException thrown by a servlet's init() method, that is
not going to work -- it only works if the exception is thrown by the
service() method (or, therefore, doGet() or doPut() on an HttpServlet).

> --
> Dominique Deleris
> http://potatoworld.tuxfamily.org

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Tomcat4 and UnavailableException

Posted by Dominique Deleris <do...@bluewin.ch>.
 Craig> I don't know if this is the only problem, but it's certainly not going to
 Craig> work if you do not use the fully qualified name of the exception class
 Craig> (javax.servlet.UnavailableException).

No, unfortunately this does not change anything. I've even tried
to subclass UnavailableException and providing the FQN, with no
success.

There seems to be a "problem" with the UnavailableException
handling with Tomcat (at least 4). Or this is by design ?

-- 
Dominique Deleris
http://potatoworld.tuxfamily.org


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>