• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Auto deploy of .WAR without any action

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

We are running a website on Tomcat 7.x and the other day Tomcat tried to auto deploy the .WAR three times in succession causing the server to crash. Our operations team informs me that there was no action being carried out on the server at the time. I am also told that auto deploy has been configured as on since the servers were implemented in production over 18 months and that they have not tried to do this before. If there were no changes at the time then it seems that there may be a serious bug in the auto deploy functionality to start to deploy for seemingly no reason. Does anyone have any experience of this happening or know of a bug report where Tomcat kicks off this activity for no explicable reason?

Thanks

Jim
 
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Jim, welcome to CodeRanch!

The code says Tomcat is comparing last modified times of exploded WAR files with system time of last deployment.
Is it possible the server timestamp changed to a previous time at that point? Summer time adjustment or something like that?
If there are some catalina logs, I think it's possible to correlate them with the code above to check what exactly happened.

As a side note, generally auto deploy is considered a development time convenience, and disabled in production.
 
Saloon Keeper
Posts: 27808
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had the same suspicion as Karthik.

The default behavior for Tomcat is that it will periodically scan the TOMCAT_HOME/webapps directory, the TOMCAT_HOME/conf/Catalina/localhost directory and possibly some other locations looking for files which have changed. Presumably since the time of the last scan, since Tomcat doesn't need the overhead of maintaining a per-file date history. So make sure your system clock is set correctly and that the timestamps in your WARs aren't set to some future date.

In the case of a WAR file in TOMCAT_HOME/webapps, IF there is no existing exploded equivalent directory, the Tomcat deployer will explode the WAR. Thereafter, changes to the WAR file itself won't be tracked, only changes to the files in the exploded WAR. At least up until about Tomcat 7. I haven't checked newer versions of Tomcat.

In the cast of changing a Context file, such as are located in TOMCAT_HOME/conf/Catalina/localhost and possibly other directories (if you define multiple hosts), Tomcat will re-deploy the corresponding WAR using the updated Context.

Tomcat's re-deployment mechanism can be problematic, Especially for versions 4 and up of Tomcat running pre-version 8 JVMs, the Permgen space wasn't completely recovered, so apps using a lot of PermGen space (such as Hibernate-JPA webapps) would tend to crash Tomcat after a couple of deploys due to lack of available PermGen space. Java 8 no longer has PermGen, though.
 
Jim Dowden
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Karthik, Tim for a great welcome to the forum. I will check with my production team but I am fairly sure that there were no time changes on the servers themselves and the .WAR file had not be changed for at least a month, and there should have been no changes to exploded director. The catalina logs only recorded a that Tomcat went in to a standard shutdown and attempted to deploy the .WAR file. This happened three times. I will let you know what they come back with.

Regards

Jim
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic