GeeCON Prague 2014*
The moose likes Tomcat and the fly likes reload tomcat context programmatically whenever java heap memory exception occurs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "reload tomcat context programmatically whenever java heap memory exception occurs" Watch "reload tomcat context programmatically whenever java heap memory exception occurs" New topic
Author

reload tomcat context programmatically whenever java heap memory exception occurs

maria kumar
Greenhorn

Joined: Jun 17, 2007
Posts: 11
Tomcat Manager web app allows me to easily restart a web app.
So,when I got the exception like Java heap memory problem, I wanted to restart the context(or call the manager URL) programmatically.
In between any request comes to server(context) will hold up to the completion of the context restart then after process that request.

Can you guide me how to achieve the above scenario.



Thanks,
Maria.

Amit Ghorpade
Bartender

Joined: Jun 06, 2007
Posts: 2716
    
    6

I think the "Out of memory error" is not meant to be caught neither the JVM will be running after this error occurs. Tomcat and JVM both will be going down. So there is no way to reload the context, to be specific store the context for later reload.
If you want to queue requests when the application is down, then my guess is you need another load balancing server or a queuing server simply because the current server is not able to bear with the load its working with.

Hope this helps


SCJP, SCWCD.
|Asking Good Questions|
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12792
    
    5
Probably not a good idea to try to recover from a memory exception by any shortcut - you need to restart the server.

Naturally figuring out why you got the exception and fixing it is the best long term plan.

Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: reload tomcat context programmatically whenever java heap memory exception occurs