File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes deleting war file from tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "deleting war file from tomcat" Watch "deleting war file from tomcat" New topic
Author

deleting war file from tomcat

Amol Dongre
Greenhorn

Joined: Sep 17, 2010
Posts: 11
after deleting the WAR file while Tomcat is running, then Tomcat not deleting the complete web app directory on linux server.
for ex. if i delete amol.war then amol dirctory still remains
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12675
    
    5
Why did you expect Tomcat to delete the directory automatically?

Bill


Java Resources at www.wbrogden.com
Sachin Pachari
Ranch Hand

Joined: Jan 16, 2012
Posts: 56

Amol Dongre wrote:after deleting the WAR file while Tomcat is running, then Tomcat not deleting the complete web app directory on linux server.
for ex. if i delete amol.war then amol dirctory still remains


I really dont understand what you are expecting from tomcat ?

WebContent folder is a must for a web application (or) a web project.

If are trying to remove unwanted wars from your project then, go to WebContent/WEB-INF/lib and then delete the WAR ! then build your project again.


Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60050
    
  65

Sachin Pachari wrote:WebContent folder is a must for a web application (or) a web project.

It most certainly is not.

What folder the contexts go in does not matter to Tomcat, which by default uses webapps. "WebContent" is just an artifact of your IDE and nothing more.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Sachin Pachari
Ranch Hand

Joined: Jan 16, 2012
Posts: 56

Ok My Bad ! i may Have put it wrongly, but what i ment was, for a War deployment, the contents inside the WebContent folder are important, if you delete the WebContent folder then the IDE Has nothing to Deploy.
Amol Dongre
Greenhorn

Joined: Sep 17, 2010
Posts: 11
Hi,
when we deploy war. file on tomcat it creates directory for that file automatically. so when i delete same war file from tomcat it should delete directory automaticallt. its normal behaviour of tomcat and it happens but sometimes when i delete war file the directory remains.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15632
    
  15

If you copy a war file into Tomcat's webapps directory to deploy it (and that is only one of several very different ways to deploy), then by default Tomcat will explode the WAR file into a directory of the same name. Thereafter the WAR file is completely ignored. Including that deleting the WAR file will not delete the exploded WAR directory. It also won't update the exploded WAR directory if you replace the old WAR file with a new WAR file.

However, if you delete the WAR directory and don't delete the WAR file, Tomcat will re-explode the WAR file and create a new exploded WAR directory, so you should delete the file first and then the directory.

Customer surveys are for companies who didn't pay proper attention to begin with.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15632
    
  15

Sachin Pachari wrote:Ok My Bad ! i may Have put it wrongly, but what i ment was, for a War deployment, the contents inside the WebContent folder are important


Not for me they aren't. I've never had a WebContent directory in my life even though I am using the JEE Eclipse spin that has WTP plugin pre-installed. I build using Maven and generally construct an OS installer package. I then install that package from the OS command line.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: deleting war file from tomcat
 
Similar Threads
'cleaning tomcat'
HTTP Status 404 error.. Help required.
how to change the owner of the war file in tomcat?
war file not deploying properly
How to create a war file