aspose file tools*
The moose likes Tomcat and the fly likes Regarding ' work ' directory under tomcat. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Regarding Watch "Regarding New topic
Author

Regarding ' work ' directory under tomcat.

Venkata Sirish
Ranch Hand

Joined: Apr 09, 2007
Posts: 112
Hi friends,
My question seems to be silly ... please don't mind .

What i need is , as soon as i restart my tomcat, the work folder under tomcat must be deleted. Is there any configuration that we can do through the server.xml or context.xml files ...

Thanks,
Venkata Guru
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I've read a lot of Tomcat's configuration documentation and have never seen anything like that.
Why would you need this?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Tomcat's kick off scripts are just shell/batch scripts. CATALINA_HOME is already defined, just add some lines in the scripts to kill the data under the work folder.

Why would you need this?

During production you shouldn't. During development I've had situations where no matter what I did to a file I never saw the changes. Something got hung up and the only way to fix it was to delete the contents of the work dir and let Tomcat re-create it all.


GenRocket - Experts at Building Test Data
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Originally posted by Gregg Bolinger:
Tomcat's kick off scripts are just shell/batch scripts. CATALINA_HOME is already defined, just add some lines in the scripts to kill the data under the work folder.


Not always.
If you install Tomcat as a service the shell/batch scripts are not used to start and stop Tomcat.

Originally posted by Gregg Bolinger:

During production you shouldn't. During development I've had situations where no matter what I did to a file I never saw the changes. Something got hung up and the only way to fix it was to delete the contents of the work dir and let Tomcat re-create it all.


I've had similar cases where the dates get messed up causing Jasper to ignore newer versions of JSP files.
I'm not sure I would want this to happen automatically every time Tomcat is restarted. There are things in the work directory that you might not always want to delete (like serialized sessions).

Maybe I should have asked differently.
What problem are you trying to solve by doing this?
There may be a better way.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Regarding ' work ' directory under tomcat.