Hi.

I've got a Tomcat 5.5.9 app which takes uploaded files and puts them into a
directory according to this formula: app's root dir + "/photos".
So the dir in my case is "c:\tomcat\webapps\ROOT\photos\".

However, I've just noticed that the whole ROOT context directory gets
copied to Tomcat's temp dir and the code is run from there.  So calling
getServletContext().getRealPath("/") in a servlet results in this:
"c:\tomcat\temp\0-ROOT\".
So when the files get uploaded, they get put into
"c:\tomcat\temp\0-ROOT\photos\" instead of
"c:\tomcat\webapps\ROOT\photos\".  And because it's a temp dir, when I shut
down Tomcat, it all gets deleted(except for the WEB-INF dir), so I lose the
uploaded content!  Even more strange is that it seems to be random whether
Tomcat clears the temp dir when I stop Tomcat.

I know this didn't happen before, and they only thing that changed was the
JRE version I've been using.  So I'm wondering if anyone else has seen this
behavior and can explain if it is JRE version related.
Right now, the only work-around I've got is to replace the formula that
builds the upload dir using something like 'get
System.getenv("CATALINA_HOME")+"/ROOT/photos"', but I'd rather not have to
do that.

Thanks in advance for any pointers.
-B


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to