I have a problem that, after a lot of reading and research, seems like tomcat is running another instance of itself and thus serving an old version of my updated app (or somehow has cached an older version of my webapp somewhere only serves that.) I work on the app in eclipse on a windows machine and deploy it on a Linux server as a ROOT app (Renaming the war file to a ROOT.war). What I'd like to know is if there's a way to locate the older version that tomcat is serving by getting tomcat to log an output of the context root of the servlet that's serving the older version of the app. As it stands it the moment any files created by the updated app get created in the right directory but because the app instances are different it can't access the files shortly after they're created. Any help/hints would be welcomed
Asked
Active
Viewed 3,441 times
1 Answers
4
To answer the question in the title, let your code basically do the following:
System.out.println(getServletContext().getRealPath("/"));
To solve the problem described in the question, shutdown Tomcat and delete everything in its /work
directory, delete the expanded WAR in /webapps
and remove the /Catalina
subdirectory of /conf
directory (if any) and then restart.

BalusC
- 1,082,665
- 372
- 3,610
- 3,555
-
Thanks.. Will get back to you with the result – Dark Star1 Feb 24 '11 at 17:21
-
This problem has resurfaced and this time this solution doesn't work – Dark Star1 Dec 09 '11 at 16:59
-
1The `getRealPath()` will return `null` when the container is not configured to expand the WAR on disk, but in memory instead. There's then no means of a disk path. – BalusC Dec 09 '11 at 17:09
-
Thx. I hadn't touched TC since the last time until today. – Dark Star1 Dec 09 '11 at 22:18