wood burning stoves 2.0*
The moose likes Tomcat and the fly likes Tomcat annoyances Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat annoyances" Watch "Tomcat annoyances" New topic

Tomcat annoyances

Jos Pasen

Joined: Dec 15, 2010
Posts: 5
Greetings JavaRanch,

I'm facing a couple of problems with tomcat and I hope it's cause of my own lack of knowledge , currently at my company we got two web applications running on a tomcat and I'm facing two annoyances:
1) If tomcat gets rebooted, instead of automatically starting all web applications it seem it just randomly picks one and starts up that one. I've been looking through all config files on the tomcat but I'm unable to find any line that specifies which application to start automatically. I did some research on this and basically people are saying you just have to live with this?

2) Not completely sure whether this is related to tomcat itself but when restarting tomcat and one of the two web applications start up it seems that some of my properties arn't getting fully loaded. It's a property file that contains a URL to a path where I keep some images and basically when i restart tomcat this property doesn't seem to get loaded succesfully (url = null). However if i restart the web application itself it reads the properties just fine or if the application doesn't start up automatically when tomcat gets rebooted and I start the application manually it also works perfectly.

Basically I'd be able to fix both of these problems if there's someway to create some script to startup my webapplications about 1 minute after my tomcat succesfully boots. If that's not possible I suppose I'll have to take a look at some other webcontainer.

Thanks in advance.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15960

Welcome to the JavaRanch, Jos!

There's something wrong with your Tomcat system. When Tomcat (re)starts, every deployed application starts. It doesn't just pick and choose.

A deployed application is one that has:

A) A WAR file in TOMCAT_HOME/webapps
B) An Exploded (unzipped) WAR file in TOMCAT_HOME/webapps
C) A WAR Context definition in the TOMCAT_HOME/conf/Catalina/localhost directory
D) Don't use D. I'm not even going to mention it except to say that it was an old technique now discouraged

Tomcat will attempt to start each WAR, probably - although not guaranteed to be in alphabetical order of the WAR name. Webapps are supposed to be self-contained, so the exact startup order should not matter. If a webapp fails to start for any reason, it will be deactivated (and in some cases, undeployed). Regardless, Tomcat will go on to start up the next webapp.

There's no technical reason why Tomcat can't start apps in parallel, but it apparently doesn't. Which means that it's a little easier to read the Tomcat log.

Just to put the official seal on the above statements:


Also, it's worth mentioning that an exploded WAR and all its resources (including classes) will totally override a non-exploded WAR of the same name, even if the non-exploded WAR is newer. This can lead to trouble, since if Tomcat is configured in the usual way, it will explode WAR files as they deploy, resulting in both non-exploded and exploded copies of the WAR in the same Tomcat environment.

Customer surveys are for companies who didn't pay proper attention to begin with.
I agree. Here's the link: http://aspose.com/file-tools
subject: Tomcat annoyances
Similar Threads
Properties file loaded during Startup of server is not getting reflected
Any experiences with migration from Tomcat 5 to Tomcat 6?
Compilation exeption
Web applications only deployed after restart of tomcat
One thread as a scheduler on webserver