Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Tomcat Wiki" for change 
notification.

The "HowTo/FasterStartUp" page has been changed by KonstantinKolinko:
https://wiki.apache.org/tomcat/HowTo/FasterStartUp?action=diff&rev1=16&rev2=17

Comment:
Correction: TLD scanning does occur at startup. I was confused that there are 
two TLD scans and the first one happens silently.

  
  These features require scanning the JAR files. The worst is scanning for 
annotated classes. There are a lot of class files to process and parsing a 
class file takes noticeable time.
  
- It is possible to configure a web application to omit most of the scanning. 
It is also possible to configure which JARs Tomcat should skip in its scanning.
+ It is possible to configure a web application to omit most of the scanning. 
It is also possible to configure which JARs Tomcat should skip.
  
  Other features that require scanning are:
  
-  *  Discovery of tag libraries (`META-INF/**/*.tld`) (shortened as TLD 
scanning)
+  *  Discovery of tag libraries — scanning for Tag Library Descriptor 
files (`META-INF/**/*.tld`) (shortened as TLD scanning)
  
- The TLD scanning happens when Tomcat needs to compile a JSP page. It does not 
affect the startup time, but does affect the access time for the first 
not-yet-compiled JSP page in the web application.
+ The TLD scanning is done at startup, because a library can define a 
`Listener` in its TLD file.
+ 
+ A note: in Tomcat 7 and earlier the TLD scanning happens twice, (1) by 
servlet engine to discover the listeners, (2) by JSP engine when compiling a 
JSP page. The first scanning happens at startup time (in `TldConfig`), the 
second one happens when Tomcat needs to compile a JSP page (in 
`TldLocationsCache`). The second scanning is more noticeable, because it prints 
a diagnostic message about scanned JARs that contained no TLDs. In Tomcat 8 the 
TLD scanning happens only once at startup time (in `JasperInitializer`).
+ 
  
  == Remove unnecessary JARs ==
  
@@ -37, +40 @@

   1. `metadata-complete="true"` attribute on the `<web-app>` element.
   2. an empty `<absolute-ordering />` element.
  
- "`metadata-complete="true"`" disables scanning your web application and its 
libraries for classes that use annotations to define components of a web 
application (Servlets etc.). This option is not enough to disable all of 
annotation scanning. If there is a SCI with a @HandlesTypes annotation, Tomcat 
has to scan your application for classes that use annotations or interfaces 
specified in that @HandlesTypes annotation and provide the list of such classes 
to the SCI.
+ Setting `metadata-complete="true"` disables scanning your web application and 
its libraries for classes that use annotations to define components of a web 
application (Servlets etc.).
  
- An example of such SCI is in the WebSocket API implementation jar 
(`tomcat-websocket.jar`, `tomcat7-websocket.jar`) which is included with Tomcat 
7 starting with 7.0.47.
+ The `metadata-complete` option is not enough to disable all of annotation 
scanning. If there is a SCI with a !HandlesTypes annotation, Tomcat has to scan 
your application for classes that use annotations or interfaces specified in 
that annotation.
  
- The "`<absolute-ordering>`" element specifies which web fragment JARs 
(according to the names in their `WEB-INF/web-fragment.xml` files) have to be 
scanned for SCIs, fragments and annotations. If you specify an empty 
"`<absolute-ordering/>`" it means that none of that scanning will occur. This 
feature does not affect scanning for web application resources.
+ The `<absolute-ordering>` element specifies which web fragment JARs 
(according to the names in their `WEB-INF/web-fragment.xml` files) have to be 
scanned for SCIs, fragments and annotations. An empty `<absolute-ordering/>` 
element configures that none are to be scanned.
+ 
+ Note: in Tomcat 8 the container-provided SCIs are always discovered, 
regardless of `absolute-ordering`.
+ 
+ An example of a SCI is in the WebSocket API implementation jar 
(`tomcat-websocket.jar`, `tomcat7-websocket.jar`) which is included with Tomcat 
7 starting with 7.0.47.
+ 
+ Scanning for web application resources and TLD scanning are not affected by 
these options.
  
  == Exclude JARs from scanning ==
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to