2

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.

RobV
  • 141
  • 1
  • 1
  • 6

1 Answers1

4

Tomcat 6 behavior for deploying apps at startup is controlled by the deployOnStartup parameter in 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

fracz
  • 324
  • 1
  • 12
Tom
  • 10,886
  • 5
  • 39
  • 62