Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

deleting war file from tomcat

 
Amol Dongre
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13071
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why did you expect Tomcat to delete the directory automatically?

Bill
 
Sachin Pachari
Ranch Hand
Posts: 56
Eclipse IDE Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65116
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Sachin Pachari
Ranch Hand
Posts: 56
Eclipse IDE Netbeans IDE Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18277
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic