1

I've been searching the web for solutions of my problem, but none of them could solve my problem.

The problem is my Tomcat v8.0 takes about 15s to start with about 2 pages loaded in JSF (only JSF and Maven).

Disabling TLD Scanner causes my context not to load properly and JSF not to load Faces controller correctly.

I guess it has to do with TLD Scanning, but don't know if I can get it better. In other pc's its running smooth in 700ms.

THe following is the console output after telling the server to start:

mai 08, 2018 10:43:04 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1549 ms
mai 08, 2018 10:43:04 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
mai 08, 2018 10:43:04 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/8.0.36
mai 08, 2018 10:43:15 AM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
mai 08, 2018 10:43:22 AM org.apache.jasper.servlet.TldScanner scanJars
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
mai 08, 2018 10:43:22 AM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra 2.0.1 (FCS b02) for context '/myteste'
mai 08, 2018 10:43:23 AM com.sun.faces.spi.InjectionProviderFactory createInstance
INFO: JSF1048: PostConstruct/PreDestroy annotations present.  ManagedBeans methods marked with these annotations will have said annotations processed.
mai 08, 2018 10:43:24 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-nio-8080"]
mai 08, 2018 10:43:24 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-nio-8009"]
mai 08, 2018 10:43:24 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 19799 ms

It could be memory, but its so little I'm loading that I dont think so.

Tiago Duque
  • 1,956
  • 1
  • 12
  • 31
  • Did you try to set the `org.apache.jasper.servlet.TldScanner` to debug to verify scanning of which jars takes up the time. You can then just blacklist those jars using the `tomcat.util.scan. StandardJarScanFilter.jarsToSkip` property. – DrHopfen May 08 '18 at 14:19
  • Ok, but should I change the catalina.properties inside my eclipse server folder? I did add the line to the properties but found no logging. – Tiago Duque May 08 '18 at 14:54
  • Yes, the latter property goes to catalina.properties. In the first step you need to change the org.apache.jasper.servlet.TldScanner loglevel to FINE in logging.properties – DrHopfen May 09 '18 at 06:49
  • @DrHopfen Here's the logging: https://pastebin.com/jDTJZqub; It seems to have to do with the JRE. Could you explain it to me better? – Tiago Duque May 09 '18 at 11:08
  • Mhm I think it is rather strange that the scanner tries to find TLDs in the jre related jars. To solve the symtom of the slow start you could add the property `tomcat.util.scan.DefaultJarScanner.jarsToSkip=resources.jar,rt.jar...` and all the other jars that are mentioned in the line 82ff. to your catalina.properties to exclude them from scanning. – DrHopfen May 09 '18 at 11:51
  • DId it and it reduced startup to 5s. But sometimes it just removes the jars from the config file. – Tiago Duque May 09 '18 at 12:35
  • I'm not using the eclipse embedded tomcat. Maybe you can find help on perisisting the change to the config properties here: http://wiki.eclipse.org/WTP_Tomcat_FAQ – DrHopfen May 09 '18 at 12:39
  • Found solution in: https://stackoverflow.com/questions/13196982/catalina-properties-gets-overridden-on-tomcat-restart – Tiago Duque May 09 '18 at 13:58

0 Answers0