You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Darren Govoni <dg...@metadapt.com> on 2005/03/06 15:54:10 UTC

load-on-startup servlet needs access

Hi,
  I wasn't able to do a full text search of archive message bodies on
this, so pardons if its old problem. I have a servlet that I designate
to load-on-startup, but that servlet calls a class that needs to access
the tomcat server to get resources. It just hangs because the server is
not ready to serve yet. How can I have my servlet loaded on startup, but
after the web server is up and running? Not possible?

thanks,
Darren

Re: load-on-startup servlet needs access

Posted by Darren Govoni <dg...@metadapt.com>.
Darn it. Thanks anyway.

Well, I think it makes a lot of sense to delay loading some servlets
until AFTER the server is up and running. Maybe soon we will see such an
operation.

maybe?

<load-on-startup>-100</load-on-startup>



On Sun, 2005-03-06 at 10:00 -0500, Tim Funk wrote:

> If you are performing a http request during init() - you are out of luck.
> 
> If you need to load resources (plain old files) - you can use 
> ServletContext.getResourceAsStream()
> 
> -Tim
> 
> Darren Govoni wrote:
> > Hi,
> >   I wasn't able to do a full text search of archive message bodies on
> > this, so pardons if its old problem. I have a servlet that I designate
> > to load-on-startup, but that servlet calls a class that needs to access
> > the tomcat server to get resources. It just hangs because the server is
> > not ready to serve yet. How can I have my servlet loaded on startup, but
> > after the web server is up and running? Not possible?
> > 
> > thanks,
> > Darren
> > 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

Re: load-on-startup servlet needs access

Posted by Tim Funk <fu...@joedog.org>.
If you are performing a http request during init() - you are out of luck.

If you need to load resources (plain old files) - you can use 
ServletContext.getResourceAsStream()

-Tim

Darren Govoni wrote:
> Hi,
>   I wasn't able to do a full text search of archive message bodies on
> this, so pardons if its old problem. I have a servlet that I designate
> to load-on-startup, but that servlet calls a class that needs to access
> the tomcat server to get resources. It just hangs because the server is
> not ready to serve yet. How can I have my servlet loaded on startup, but
> after the web server is up and running? Not possible?
> 
> thanks,
> Darren
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: load-on-startup servlet needs access

Posted by Shankar Unni <sh...@netscape.net>.
Darren Govoni wrote:

> How can I have my servlet loaded on startup, but
> after the web server is up and running? Not possible?

Well, you can always start a thread that does this initialization, and 
return. Then, when the full Tomcat initialization is complete, your 
thread will run to completion (assuming it's doing a GET or POST from 
that instance itself..)


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org