Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a Java web app which I'm deploying using Tomcat but I'm having some trouble with this.

The problem is that my web app has to talk to some native libraries (via JNI) and those libraries do not handle errors that gracefully so if I try to start Tomcat and the native calls fail Tomcat startup halts partway through and does not start.

What I would like to do is have Tomcat not start this web app when it starts as I'll be using other means to start the web app which will ensure that the native calls will work. Specifically the native calls are to talk to another system which must already be running for the native calls to succeed.

One interesting thing I've found is that if I reload the app once Tomcat is successfully running failures in the native libraries only cause the context to fail and Tomcat continues running fine.

I've googled around and seen pointers to the context.xml file but it is unclear to me if I can use this to achieve my aim as the Tomcat reference doesn't seem to list any properties which stop a context automatically being loaded at startup.

share|improve this question

marked as duplicate by Katherine Villyard, mdpc, Sven Jan 14 at 12:44

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

tomcat 6 behaviour for deploying apps at startup is controlled by the deployOnStartup parameter to a Host element in the server.xml file;

<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true" deployOnStartup="false" xmlValidation="false" xmlNamespaceAware="false" deployIgnore=".svn"> </Host>

However with autoDeploy set to "true" tomcat also supports hot deployment of war and context files that are located in the appBase or the conf/localhost/Catalina folder, so its not clear whether tomcat would see those existing war files and deploy them also. Hence it might be necessary to set autoDeploy="false" also. In that scenario you would need to use tomcat manager tool to deploy your webapps to the running tomcat server

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.