Search code examples
tomcat7web-deployment

Tomcat 7, cannot disable web application autoDeploy


After deploying a web application, my Tomcat 7 server doesn't start anymore, signaling an exception during startup process.

So I tried to configure Tomcat to avoid to deploy the webapps at startup.
To do so, I've modified my ${CATALINA_BASE}/conf/server.xml and add an autoDeploy="false" attribute to the Host node. (I've also verified that there are no liveDeploy attributes):

<Host appBase="webapps" autoDeploy="false" name="localhost" unpackWARs="true">
...

then I read about liveDeploy attribute with a slightly different behaviour, and to be sure I disabled it too:

<Host appBase="webapps" autoDeploy="false" liveDeploy = "false" name="localhost" unpackWARs="true">
...

The problem is that it seems to do nothing, and in the outuput I still see "Deploying configuration descriptor" lines, till the one that crashes Tomcat.

Here there is the server output; I've include the startup, a first application (MyFirstApplication) that is deployed correctly, and the last one that crashses the server.

Using CATALINA_BASE:   "C:\Users\Jack\AppData\Roaming\NetBeans\7.2\apache-tomcat-7.0.11.0_base"
Using CATALINA_HOME:   "C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.11"
Using CATALINA_TMPDIR: "C:\Users\Jack\AppData\Roaming\NetBeans\7.2\apache-tomcat-7.0.11.0_base\temp"
Using JRE_HOME:        "C:\Program Files (x86)\Java\jdk1.7.0"
Using CLASSPATH:       "C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.11\bin\bootstrap.jar;C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.11\bin\tomcat-juli.jar"
gen 14, 2013 3:08:28 PM org.apache.catalina.core.AprLifecycleListener init
Informazioni: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files (x86)\Java\jdk1.7.0\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Perl64\site\bin;C:\Perl64\bin;C:\Program Files (x86)\CollabNet\Subversion Client;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\12.0\DLLShared\;C:\Program Files (x86)\Roxio\OEM\AudioCore\;C:\Program Files\Java\jdk1.6.0_23\bin;C:\Program Files (x86)\GnuWin32\bin;C:\Program Files (x86)\spring-roo-1.1.4.RELEASE\bin;C:\Program Files\NetBeans 6.9.1\java\ant\bin;C:\Program Files (x86)\GNU\GnuPG\pub;C:\Program Files (x86)\QuickTime\QTSystem\;c:\Program Files\NetBeans 7.2\java\maven\bin;C:\Program Files (x86)\Nmap;C:\cmdutilities;.
gen 14, 2013 3:08:28 PM org.apache.coyote.AbstractProtocolHandler init
Informazioni: Initializing ProtocolHandler ["http-bio-8084"]
gen 14, 2013 3:08:28 PM org.apache.coyote.AbstractProtocolHandler init
Informazioni: Initializing ProtocolHandler ["ajp-bio-8009"]
gen 14, 2013 3:08:28 PM org.apache.catalina.startup.Catalina load
Informazioni: Initialization processed in 411 ms
gen 14, 2013 3:08:28 PM org.apache.catalina.core.StandardService startInternal
Informazioni: Starting service Catalina
gen 14, 2013 3:08:28 PM org.apache.catalina.core.StandardEngine startInternal
Informazioni: Starting Servlet Engine: Apache Tomcat/7.0.11
gen 14, 2013 3:08:28 PM org.apache.catalina.startup.HostConfig deployDescriptor
Informazioni: Deploying configuration descriptor MyFirstWebApp.xml from C:\Users\Jack\AppData\Roaming\NetBeans\7.2\apache-tomcat-7.0.11.0_base\conf\Catalina\localhost
gen 14, 2013 3:08:38 PM org.springframework.web.context.ContextLoader initWebApplicationContext
Informazioni: Root WebApplicationContext: initialization started
[...]
Informazioni: Deploying configuration descriptor manager.xml from C:\Users\Jack\AppData\Roaming\NetBeans\7.2\apache-tomcat-7.0.11.0_base\conf\Catalina\localhost
gen 14, 2013 3:08:40 PM org.apache.catalina.startup.HostConfig deployDescriptor
Informazioni: Deploying configuration descriptor MavenSpringHibernate.xml from C:\Users\Jack\AppData\Roaming\NetBeans\7.2\apache-tomcat-7.0.11.0_base\conf\Catalina\localhost
Exception in thread "main" Exception in thread "Thread-1" 

Solution

  • You want set deployOnStartup, not autoDeploy (or possibly both). There is no such setting of liveDeploy.

    From the Tomcat 7 docs for Host [1]

    autoDeploy

    This flag value indicates if Tomcat should check periodically for new or updated web applications while Tomcat is running. If true, Tomcat periodically checks the appBase and xmlBase directories and deploys any new web applications or context XML descriptors found. Updated web applications or context XML descriptors will trigger a reload of the web application. The flag's value defaults to true. See Automatic Application Deployment for more information.

    deployOnStartup

    This flag value indicates if web applications from this host should be automatically deployed when Tomcat starts. The flag's value defaults to true. See Automatic Application Deployment for more information.

    [1] http://tomcat.apache.org/tomcat-7.0-doc/config/host.html