You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Stadelmann Josef <jo...@axa-winterthur.ch> on 2013/03/20 10:06:15 UTC

[tomcat] preventing to use it at startup

Hi

Is there an easy way to manage, to prevent, that my AS Tomcat is serving

request before it is fully up and running; while fully up means - it has
deployed 
all web apps and web app axis2 (a servlet engine) is up and has deployed
all its
modules *.mar and web service archives *.aar before any requests for
this web
services are accepted.

Josef

Re: [tomcat] preventing to use it at startup

Posted by Mark Thomas <ma...@apache.org>.
On 21/03/2013 13:06, Christopher Schultz wrote:
> Mark,
> 
> On 3/21/13 6:17 AM, Mark Thomas wrote:
>> The connector is not started until all web applications have been
>>  started. That means that: - all loadOnStartup servlets have
>> been loaded - all ServletContextListeners have completed - etc.
> 
>> It also means that Tomcat has finished its internal startup for 
>> the Contexts, Host(s) and Engine.
> 
>> There are no hooks (apart from receiving a request) for a web 
>> application to trigger any further initialisation so it must be 
>> ready to process requests at this point.
> 
> When a webapp is reloaded, the connection will remain running with
> no interruption, right? Requests to that webapp will stall until
> the webapp is back up again?

Yes. They will he held by Tomcat until the web app is back up.

> IIRC, it used to be that during a webapp reload, you might get
> weird responses either from Tomcat or the ROOT webapp (it might
> have been because I was running without a ROOT webapp, which I have
> since fixed).

That was mostly likely one of the bugs in this area that got fixed.

> What about the case of re-deployment? Does it behave just like a
> reload?

No. You'll get 404s.

Mark

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


Re: [tomcat] preventing to use it at startup

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Mark,

On 3/21/13 6:17 AM, Mark Thomas wrote:
> The connector is not started until all web applications have been 
> started. That means that: - all loadOnStartup servlets have been
> loaded - all ServletContextListeners have completed - etc.
> 
> It also means that Tomcat has finished its internal startup for
> the Contexts, Host(s) and Engine.
> 
> There are no hooks (apart from receiving a request) for a web 
> application to trigger any further initialisation so it must be
> ready to process requests at this point.

When a webapp is reloaded, the connection will remain running with no
interruption, right? Requests to that webapp will stall until the
webapp is back up again?

IIRC, it used to be that during a webapp reload, you might get weird
responses either from Tomcat or the ROOT webapp (it might have been
because I was running without a ROOT webapp, which I have since fixed).

What about the case of re-deployment? Does it behave just like a reload?

Thanks,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJRSwXTAAoJEBzwKT+lPKRYxZ0P/1lMCCYW6+TrJTL6PdWT7Ge8
D3MVmcP+5xpmglaMJXw1ssf7nOmBDlalzRGHT1MZywPVcPAzZWrVAjdRqGrQqU0p
AXpYxe9LVFm7+1wa1zvmX+FgXX59AHpLtlX+xHxhF38VtYD2H4u6VxtqEj4dnUGS
mpSH7q7on8VkVsSZqA8zEKO5Qwkrt9WDXrl8C2CVWB4xLv/5pWEtMZQ00Fbo8Yw5
4bpvMGqH9rEwVFcDqH/OmFAynm3qUS6R6YcDcHVlyZbIasKKfSDCDv/wN8ZROsFt
Szv6ee0wvvsEu6CN9R9nongAPvqXRphr4CD1inffXoWQcrMIZ1Vp5ooCG6zY30GM
CGjHmXCVb9Tr8Cn+md7nxd1XOZc1QRxm0skPkxankL92wUw4unAvZ4mZ4L9Xie3E
RQUuYHw1MheaoC3qPHi0WOMlkI3ijppX9A5rwAo7wpqM4TSqOkA35E3OzTOSwBsa
RABgNRhj8CAp+Fa5or6vwa1bf24rRa8p5EgR30/pFHF4kUrkygEc0fC1Xg71igTj
NoS+Ixl48tVIw/G1GLrSbv3WXYfwIwE223DSjg7ciRwGohzvgRoTejr3Fz9s/gsa
ul08kisYp722JirBqVHL7GnQ3z7XId+EUD1tMmFtCqEEPJtV8Oxm+YRDbmpj3cKb
IV8GwpTeA1FGEEUYkWcx
=TWBd
-----END PGP SIGNATURE-----

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


Re: [tomcat] preventing to use it at startup

Posted by Mark Thomas <ma...@apache.org>.
On 21/03/2013 09:57, André Warnier wrote:
> Stadelmann Josef wrote:
>> Hi
>>
>> Is there an easy way to manage, to prevent, that my AS Tomcat is serving
>>
>> request before it is fully up and running; while fully up means - it has
>> deployed all web apps and web app axis2 (a servlet engine) is up and
>> has deployed
>> all its
>> modules *.mar and web service archives *.aar before any requests for
>> this web
>> services are accepted.
>>
> Hi.
> I believe that the basic answer to this question is no.
> The only thing which knows when an application is ready to answer
> requests is .. that same application.
> 
> It is not very clear to me what the "bindOnInit" Connector attribute
> means exactly in that respect :
> 
> bindOnInit   
> 
> Controls when the socket used by the connector is bound. By default it
> is bound when the connector is initiated and unbound when the connector
> is destroyed. If set to false, the socket will be bound when the
> connector is started and unbound when it is stopped.
> 
> (It is probably my lack of knowledge of what precisely is meant by "the
> connector is initiated" versus "the connector is started" here)
> 
> But even assuming that it delays the moment when the Connector binds to
> the port (meaning that until then, the listening port is not open, and
> no clients can connect to it), the Connector is shared between /all/
> applications, so I think that it would be difficult for the Connector
> "to know" when /all/ applications are really "ready".  Different
> applications may have different ideas of when they are really "ready to
> serve requests".

The connector is not started until all web applications have been
started. That means that:
- all loadOnStartup servlets have been loaded
- all ServletContextListeners have completed
- etc.

It also means that Tomcat has finished its internal startup for the
Contexts, Host(s) and Engine.

There are no hooks (apart from receiving a request) for a web
application to trigger any further initialisation so it must be ready to
process requests at this point.

Mark


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


Re: [tomcat] preventing to use it at startup

Posted by André Warnier <aw...@ice-sa.com>.
Stadelmann Josef wrote:
> Hi
> 
> Is there an easy way to manage, to prevent, that my AS Tomcat is serving
> 
> request before it is fully up and running; while fully up means - it has
> deployed 
> all web apps and web app axis2 (a servlet engine) is up and has deployed
> all its
> modules *.mar and web service archives *.aar before any requests for
> this web
> services are accepted.
> 
Hi.
I believe that the basic answer to this question is no.
The only thing which knows when an application is ready to answer requests is .. that same 
application.

It is not very clear to me what the "bindOnInit" Connector attribute means exactly in that 
respect :

bindOnInit	

Controls when the socket used by the connector is bound. By default it is bound when the 
connector is initiated and unbound when the connector is destroyed. If set to false, the 
socket will be bound when the connector is started and unbound when it is stopped.

(It is probably my lack of knowledge of what precisely is meant by "the connector is 
initiated" versus "the connector is started" here)

But even assuming that it delays the moment when the Connector binds to the port (meaning 
that until then, the listening port is not open, and no clients can connect to it), the 
Connector is shared between /all/ applications, so I think that it would be difficult for 
the Connector "to know" when /all/ applications are really "ready".  Different 
applications may have different ideas of when they are really "ready to serve requests".

If this is really vital for you, I would look at a servlet filter wrapping your 
application, and some means of communication between that filter and your application.
For example, as long as some "ready flag" is not set, the filter would redirect all 
requests to some "sorry" page; once the flag is set, it would let the requests go through.
And the application would set this flag when it considers itself to be "ready".

Over the years on this list, there have been several questions also related to a 
synchronisation between *different* applications, which is also difficult to do, because 
different applications are supposed to be independent of eachother.
So may, writing this as a <Valve> (tomcat-specific) at the Host level would be more 
generic and fill some other needs too.

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


AW: [tomcat] preventing to use it at startup

Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
Thanks and your right Jeffery, 
but our Server is OpenVMS and we don't have any Server side firewalls 
installed. So I would need to check if there is a FW SW for OpenVMS.
Josef 

-----Ursprüngliche Nachricht-----
Von: Harris, Jeffrey E. [mailto:Jeffrey.Harris@ManTech.com] 
Gesendet: Mittwoch, 20. März 2013 17:26
An: Tomcat Users List
Betreff: RE: [tomcat] preventing to use it at startup



> -----Original Message-----
> From: Stadelmann Josef [mailto:josef.stadelmann@axa-winterthur.ch]
> Sent: Wednesday, March 20, 2013 12:15 PM
> To: Tomcat Users List
> Subject: AW: [tomcat] preventing to use it at startup
>
> Thank you Jeffrey
>
> BUT
> we are not FW owner, AND
> we are so tiny little smalls in the AXA world AND our holly FW 
> godfather admin is keeping his fingers on the holly FW.
>
> But why can tomcat not close and open the port 8080 and keep it in a 
> way inexistent for external access unless the server is really up!
> I am not a TCP socket expert, so I do not know what else we can do to 
> prevent that a request from our users reaching the server too early.
>
> How is that normally I intend to GET a html page and get the return 
> saying "Sorry but server maintenance work is in progress blab la bla"?
>
>
> Josef
>

Josef,

I am suggesting that you use the firewall on the local server, not the network ("holly") firewall.
If you have access to the server, you can configure a local firewall.  Both Windows and Linux have built-in firewalls, and generally they are already active, but you may need to turn them on if they are disabled, and they will need to be configured to open and close port 8080.

Jeffrey Harris

This e-mail and any attachments are intended only for the use of the addressee(s) named herein and may contain proprietary information. If you are not the intended recipient of this e-mail or believe that you received this email in error, please take immediate action to notify the sender of the apparent error by reply e-mail; permanently delete the e-mail and any attachments from your computer; and do not disseminate, distribute, use, or copy this message and any attachments.

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


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


RE: [tomcat] preventing to use it at startup

Posted by "Harris, Jeffrey E." <Je...@ManTech.com>.

> -----Original Message-----
> From: Stadelmann Josef [mailto:josef.stadelmann@axa-winterthur.ch]
> Sent: Wednesday, March 20, 2013 12:15 PM
> To: Tomcat Users List
> Subject: AW: [tomcat] preventing to use it at startup
>
> Thank you Jeffrey
>
> BUT
> we are not FW owner, AND
> we are so tiny little smalls in the AXA world AND our holly FW
> godfather admin is keeping his fingers on the holly FW.
>
> But why can tomcat not close and open the port 8080 and keep it in a
> way inexistent for external access unless the server is really up!
> I am not a TCP socket expert, so I do not know what else we can do to
> prevent that a request from our users reaching the server too early.
>
> How is that normally I intend to GET a html page and get the return
> saying "Sorry but server maintenance work is in progress blab la bla"?
>
>
> Josef
>

Josef,

I am suggesting that you use the firewall on the local server, not the network ("holly") firewall.
If you have access to the server, you can configure a local firewall.  Both Windows and
Linux have built-in firewalls, and generally they are already active, but you may need
to turn them on if they are disabled, and they will need to be configured to open and
close port 8080.

Jeffrey Harris

This e-mail and any attachments are intended only for the use of the addressee(s) named herein and may contain proprietary information. If you are not the intended recipient of this e-mail or believe that you received this email in error, please take immediate action to notify the sender of the apparent error by reply e-mail; permanently delete the e-mail and any attachments from your computer; and do not disseminate, distribute, use, or copy this message and any attachments.

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


Re: AW: [tomcat] preventing to use it at startup

Posted by Mark Thomas <ma...@apache.org>.
On 20/03/2013 16:14, Stadelmann Josef wrote:
> Thank you Jeffrey
> 
> BUT 
> we are not FW owner, AND
> we are so tiny little smalls in the AXA world AND
> our holly FW godfather admin is keeping his fingers on the holly FW.
> 
> But why can tomcat not close and open the port 8080 and keep 
> it in a way inexistent for external access unless the server is really up!
> I am not a TCP socket expert, so I do not know what else we can do to prevent 
> that a request from our users reaching the server too early.
> 
> How is that normally I intend to GET a html page and get the return saying 
> "Sorry but server maintenance work is in progress blab la bla"?

Tomcat provides no such messages by default so something else is
providing that.

For a clean Tomcat install, the setting you want is bindOnInit="false" from:
http://tomcat.apache.org/tomcat-7.0-doc/config/http.html

Mark

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


AW: [tomcat] preventing to use it at startup

Posted by Stadelmann Josef <jo...@axa-winterthur.ch>.
Thank you Jeffrey

BUT 
we are not FW owner, AND
we are so tiny little smalls in the AXA world AND
our holly FW godfather admin is keeping his fingers on the holly FW.

But why can tomcat not close and open the port 8080 and keep 
it in a way inexistent for external access unless the server is really up!
I am not a TCP socket expert, so I do not know what else we can do to prevent 
that a request from our users reaching the server too early.

How is that normally I intend to GET a html page and get the return saying 
"Sorry but server maintenance work is in progress blab la bla"?


Josef

-----Ursprüngliche Nachricht-----
Von: Harris, Jeffrey E. [mailto:Jeffrey.Harris@ManTech.com] 
Gesendet: Mittwoch, 20. März 2013 13:19
An: Tomcat Users List
Betreff: RE: [tomcat] preventing to use it at startup



> -----Original Message-----
> From: Stadelmann Josef [mailto:josef.stadelmann@axa-winterthur.ch]
> Sent: Wednesday, March 20, 2013 5:06 AM
> To: users@tomcat.apache.org
> Subject: [tomcat] preventing to use it at startup
>
> Hi
>
> Is there an easy way to manage, to prevent, that my AS Tomcat is 
> serving
>
> request before it is fully up and running; while fully up means - it 
> has deployed all web apps and web app axis2 (a servlet engine) is up 
> and has deployed all its modules *.mar and web service archives *.aar 
> before any requests for this web services are accepted.
>
> Josef

Just as a quick thought, presuming you have a way of determining that the server is ready, why not just block the port on the local firewall until the server is ready, and then unblock the port?  That means you would have to turn the firewall on if it is not currently running.

You could script this into a startup task on the server.

Jeffrey Harris

This e-mail and any attachments are intended only for the use of the addressee(s) named herein and may contain proprietary information. If you are not the intended recipient of this e-mail or believe that you received this email in error, please take immediate action to notify the sender of the apparent error by reply e-mail; permanently delete the e-mail and any attachments from your computer; and do not disseminate, distribute, use, or copy this message and any attachments.

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


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


RE: [tomcat] preventing to use it at startup

Posted by "Harris, Jeffrey E." <Je...@ManTech.com>.

> -----Original Message-----
> From: Stadelmann Josef [mailto:josef.stadelmann@axa-winterthur.ch]
> Sent: Wednesday, March 20, 2013 5:06 AM
> To: users@tomcat.apache.org
> Subject: [tomcat] preventing to use it at startup
>
> Hi
>
> Is there an easy way to manage, to prevent, that my AS Tomcat is
> serving
>
> request before it is fully up and running; while fully up means - it
> has deployed all web apps and web app axis2 (a servlet engine) is up
> and has deployed all its modules *.mar and web service archives *.aar
> before any requests for this web services are accepted.
>
> Josef

Just as a quick thought, presuming you have a way of determining that the server is ready,
why not just block the port on the local firewall until the server is ready, and then unblock
the port?  That means you would have to turn the firewall on if it is not currently
running.

You could script this into a startup task on the server.

Jeffrey Harris

This e-mail and any attachments are intended only for the use of the addressee(s) named herein and may contain proprietary information. If you are not the intended recipient of this e-mail or believe that you received this email in error, please take immediate action to notify the sender of the apparent error by reply e-mail; permanently delete the e-mail and any attachments from your computer; and do not disseminate, distribute, use, or copy this message and any attachments.

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