You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Steve Weiss <sw...@aamc.org> on 2000/10/03 00:16:11 UTC

Re: Getting tomcat to instantiate an instance of a servlet after failed initialization attemp

> Renee Petris wrote:
> 
> I have a servlet that attempts to connect to a remote service during
> the init method. If the remote service is unavailable, the servlet
> throws a ServletException. If I then fix the problem, i.e. make the
> service available, and retry the servlet, Tomcat doesn't try to
> re-instantiate the servlet. I've checked this by putting a println
> statement in the init method. I have to restart Tomcat to get the
> servlet to start. According to the servlet spec, the servlet container
> may instantiate a new instance at any time after a failed
> initialization attempt unless the servlet threw an
> UnavailableException. Is there a way to make tomcat attempt to
> re-instantiate the servlet?
> 

I don't know if what you're asking is possible, but you could accomplish
what you want by starting up a background thread in your servlet's
init() method which just keeps trying to connect to the remote object.

-Steve
-- 
Steve Weiss      Association of American Medical Colleges
(202)828-0428    mailto:sweiss@aamc.org    http://www.aamc.org