Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 78020 invoked from network); 12 Oct 2009 16:58:24 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Oct 2009 16:58:24 -0000 Received: (qmail 76114 invoked by uid 500); 12 Oct 2009 16:58:20 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 76011 invoked by uid 500); 12 Oct 2009 16:58:19 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 75999 invoked by uid 99); 12 Oct 2009 16:58:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Oct 2009 16:58:19 +0000 X-ASF-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [80.68.94.31] (HELO mta.unknown.za.net) (80.68.94.31) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Oct 2009 16:58:16 +0000 Received: from bpet (dsl-243-84-77.telkomadsl.co.za [41.243.84.77]) by mta.unknown.za.net (Postfix) with ESMTPSA id 5F40C4A55B for ; Mon, 12 Oct 2009 18:57:53 +0200 (SAST) Received: from [127.0.0.1] (localhost [127.0.0.1]) by bpet (Postfix) with ESMTP id B05224F40FB for ; Mon, 12 Oct 2009 18:57:44 +0200 (SAST) Message-ID: <4AD36007.3050703@unknown.za.net> Date: Mon, 12 Oct 2009 18:57:43 +0200 From: Jesse Long User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: Tomcat Users List Subject: Re: Persistent Storage for Webapps References: <4AD30C98.2020309@unknown.za.net> <20091012182251.3ad1f1e5@tclx.cataneo.buero> In-Reply-To: <20091012182251.3ad1f1e5@tclx.cataneo.buero> Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Tobias Crefeld wrote: > Am Mon, 12 Oct 2009 13:01:44 +0200 > schrieb Jesse Long : > > >> In my webapp I need persistent storage. I am building my webapp as a >> .war file, and copying it into $CATALINE_HOME/webapps/ >> >> Tomcat extracts $CATALINA_HOME/webapps/app.war to >> $CATALINA_HOME/webapps/app/ >> >> The war file contains an empty directory /WEB-INF/data . During >> operations, data files are created under /WEB-INF/data/ >> > > WEB-INF should contain only static files which shouldn't be accessible > by Webclients (directly), e.g. by /app/data/filename . So it seems to > be a bad place > > > >> Question: id /WEB-INF/ in the extracted directory the correct place >> for persistent data storage? If not, where is? >> > > AFAIK there is no general advise where to put dynamic, persistent data. > As system administrator I prefer solutions that give me the opportunity > to decide myself where to put dynamic data. There are a lot of reasons > for this: securing against disk space overflow, backup, priviledge > separation, etc. > > Following this way you might create a "properties-"file outside the > Tomcat-hierarchy at a sensible place (e.g. /etc/app.properties) with > the paths your application should use. > > Another way is to define a Tomcat-parameter during JVM-startup that will > contain the path to your data-directory. As this might not survive the > next update of Tomcat itself I don't like this kind of configuration > but some applications and classes are working this way. > > > >> My goal is to find a consistent way of creating persistent data >> relative to the context. I dont want to have to configure context >> parameters with data directory paths for each installation. >> > > untested idea: If you have no control over the filesystem of the > target Tomcat you could create a mini-application named data.war that > you are deploying. Of course there is always the danger of accidentally > erasing the data by re-deploying this pseudo-application. And you will > have to find a way by valves, etc. to preserve this path from being > accessed by web-clients. Maybe it is enough if you leave out the > context-entry. > Thanks for your answers Tobias. Unfortunately we have a very real use case for multiple instances on one host, with different data paths. So, /etc/app.properties is not usable, but /etc/app-.properties might be but virtual hosting would break. No way to identify unique host consistently. Also, I could use a path name derived from the temp directory name, but nothing says the temp directory name will be consistent. For now I will reluctantly use context parameters. Thanks, Jesse --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org