Tomcat 7 slow start metadata-complete="true" web.xml
java, metadata, tomcat7, web.xml
Solution
The metadata-complete didn't resolve my startup time issues either. The problem is that tomcat scans multiple (almost all jars) at startup for annotations and tld files. Of course, not all jars contains tld files and annotations. To improve your startup times you can exclude these jars. Something like the following should do the trick: Adjust conf/catalina.properties:
org.apache.catalina.startup.ContextConfig.jarsToSkip=*.jar
# Additional JARs (over and above the default JARs listed above) to skip when
# scanning for TLDs. The list must be a comma separated list of JAR file names.
# The following list will make sure stuff like jstl and spring-webmvc.jar etc which contain tld files are included
org.apache.catalina.startup.TldConfig.jarsToSkip=a*.jar,b*.jar,c*.jar,d*.jar,e*.jar,f*.jar,g*.jar,h*.jar,i*.jar,jc*.jar, jd*.jar, je*.jar, jl*.jar, jo*.jar, JO*.jar, jr*.jar, jso*.jar, jsr*.jar, jts*.jar,k*.jar,l*.jar,m*.jar,n*.jar,o*.jar,p*.jar,q*.jar,r*.jar,spring-a*.jar, spring-c*.jar, spring-e*.jar, spring-j*.jar, spring-s*.jar, spring-test*.jar, stax*.jar, st*.jar, t*.jar,u*.jar,v*.jar,w*.jar,x*.jar,y*.jar,z*.jar
Problem
i have migrated to Tomcat 7[7.0.4.1] in the past a startUp takes between 5 or 7 seconds now takes 30 seconds i have read on other post metadata-complete="true" set in the web.xml solves the trick but seems not solved in my case i have added `metadata-complete="true"` in `WEB-INF/web.xml` and in `tomcat/conf/web.xml` neither seems to work. here is the code for `tomcat/conf/web.xml` ``` <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" metadata-complete="true" version="3.0"> ``` here is the code for `WEB-INF/web.xml` ``` <web-app metadata-complete="true" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> ``` the deploying is being sucessfully here is the trace tomcat is printing. ``` INFO: Starting Servlet Engine: Apache Tomcat/7.0.41 jul 22, 2013 4:33:08 PM org.apache.catalina.core.ApplicationContext log INFO: No Spring WebApplicationInitializer types detected on classpath ``` in this sentence is taking over 30 seconds.. ``` INFO: Starting Servlet Engine: Apache Tomcat/7.0.41 ``` my questions are: what i am doing wrong?? how can i see is metadata-complete is setting to true i am reading in others web-site this can be made checking the flag in `isMetadataComplete()` but my question is where or how can i call this method?? we are using [Spring,Hibernate,ZK] in out project.