To answer the question in the title, let your code basically do the following:
System.out.println(getServletContext().getRealPath("/"));
As described in the question to resolve the problem, close the Tomcat and delete everything in its directory /work, delete the expanded WAR in /webappsand remove the subdirectory /Catalinadirectory /conf(if any), and then restart.
source
share