tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Kriger <>
Subject contextDestroyed and getRealPath question
Date Thu, 03 Nov 2005 18:07:19 GMT
I am trying to do something in contextDestroyed that requires the
filesystem directory of the web application. However, once
contextDestroyed has been called that path no longer exists.

public void contextDestroyed(ServletContextEvent event)
	String path = event.getServletContext().getRealPath("/");
	File file = new File(path);
	System.out.println("exists? " + (file.exists())); // returns false
	System.out.println("directory? " + (file.isDirectory())); // returns false
	System.out.println("readable? " + (file.canRead())); // returns false

Is there a way to access the webapp when the application is
reloaded/stopped/undeployed but before Tomcat cleans up the temporary
directory that contains app?


For more info on what I'm trying to see
(it's the post w the code in it and I'm just trying to test it out in
my own app and see if it fixes anything)

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message