Reputation: 4333
I am working on an old Java web application that runs on Tomcat. I know that typically you run web apps from the webapps directory which uses Tomcat's default server configuration (server.xml). This particular app is deployed to a different directory using a custom server.xml so it requires 1 tomcat instance per app. I believe the reason it was initially setup that way is due to the fact that each web app produces files that must be saved between redeploys of the application.
My question is - is there a way to use the webapps directory but also save certain files from being wiped out during a redeploy of the application?
Here's the layout of our current tomcat
tomcat/
servers/
ourapp/
output/ # heres where the files go that we save
ourapp/ # this is the actual webapp (exploded WAR file)
WEB-INF/
...
I want something like
tomcat/
webapps/
ourapp/
output/ # but this is saved between redeploys
WEB-INF/
...
My end goal is to get away from custom server.xml's so we deploy multiple apps on one tomcat instance. Just in case in matters - we're on Tomcat 6.
Upvotes: 1
Views: 4080
Reputation: 120446
I'd recommend not trying to store those files in webapps/
if you want them persisted. That directory is pretty volatile. Additionally, other developers maintaining the system may not realize you've stored persistent data there and might just wipe it accidentally.
I'd go for a location in /var/lib
, perhaps /var/lib/ourapp/...
. Or you could store it in $HOME/.ourapp
if that make sense for your server environment and how it's managed.
Upvotes: 4
Reputation: 54094
I would suggest that you save your files under Tomcat
(could be outside or inside webapps
) and not in a random dir in the filesystem.
This way it is "bundled" with your webapp in a way
Upvotes: 0