Hi Neven.

Am 19-10-2014 01:15, schrieb Neven Cvetkovic:
Hey Aleks!

On Sat, Oct 18, 2014 at 6:48 PM, Aleksandar Lazic <al-tomcatu...@none.at>
wrote:

Hi all.

We have the need that the tomcat 7 connectors (ajp & http) only start
listening on the configured port after the application is started.

I have take a look at

https://tomcat.apache.org/tomcat-7.0-doc/connectors.html
https://tomcat.apache.org/tomcat-7.0-doc/config/ajp.html

but I haven't seen a "delay until app start done" flag.

I have also searched in the archive

http://marc.info/?l=tomcat-user&w=2&r=1&s=delay&q=b

I'm sure that I don't understand the tomcat internals enough to see the
easy solution.

Thanks for pointing me to the right direction.
Maybe It must be done in the app startup phase or somewhere else.


It would help if you clarify your "need" and reasons why you want this. I
suspect you don't want "traffic" until the app is ready and configured.
Tell us more about what are your specific requirements and problem you are
trying to solve.

That's exactly what we want.
The app "crashes" when requests reach the app at startup phase.
Yes I know this should be handled in the app but you know the world is not perfect ;-/

Few ideas to play with:

1) Figure out how to start Tomcat with Connectors disabled or not
configured. After your application has been successfully
deployed/configured - enable or configure your connectors. Look at JMX
MBeans for ways to enable(start)/disable(stop). Also look at the connector attribute "bindOnInit", so the connector would wait for binding to a port
until "start" operation is called on the connector MBean, e.g.

Catalina:type=Connector,port=8080
Catalina:type=Connector,port=8009

That was what I've missed, thanks.

To be clear.

1.) <Connector ... bindOnInit=false ... />
2.) Tomcat and app start
3.) when the app is ready to handle requests
    the app "just" need to start over jmx/mbean the connectors.

2) Are you using Apache or some other webserver fronting your Tomcat
instance(s)?

Yes we use the classic

https://httpd.apache.org/docs/2.2/mod/mod_proxy_ajp.html

with ping settings

https://httpd.apache.org/docs/2.2/mod/mod_proxy.html#proxypass

You could disable the application path on Apache, and once the
app is configured and ready, turn on the flood gates on Apache or whatever
webserver you use.

This is another way but I prefer the app way.

Hope that helps.

Yes thanks, for help.

Cheers!
Neven

BR Aleks

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

Reply via email to