Reputation: 21
Good Day Everyone, I am currently using Tomcat 8 and I am facing difficulty loading my project. The main issue is that it takes 3-5 minutes to get into the website. Whereas usually it will only take less than 10 seconds to load.
Previously there was no such issues, it only happened randomly today. I have tried to disable JAR Scanner by adding the code below into the context.xml. The scans were consuming most of the time according to the timestamp in the log. This was the only solution I could find, however this did not work. Please do let me know if there is any other solutions to this, thank you very much! :)
Log Message: org.apache.jasper.servlet.TldScanner.scanJars 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.
<Context>
...
<JarScanner scanClassPath="false" scanAllFiles="false" scanAllDirectories="false"
scanBootstrapClassPath="false" scanManifest="false">
</JarScanner>
...
</Context>
The other warning that was displayed on the logs is
Log message: WARNING [localhost-startStop-5] org.apache.catalina.loader.WebappClassLoaderBase.clearReferencesJdbc The web application [harvester] registered the JDBC driver [org.h2.Driver] but failed to unregister it when the web application
Upvotes: 0
Views: 1863
Reputation: 957
Try this article: https://cwiki.apache.org/confluence/display/TOMCAT/HowTo+FasterStartUp#HowToFasterStartUp-Configureyourwebapplication
For me the first advice gave significant improvement: speedup from ~4 minutes to ~1minute of start time.
This disables scanning of jars for annotations, so this makes sense only if your app is simple enough to keep all servlet configs in web.xml.
in your
WEB-INF/web.xml
file:
- Set metadata-complete="true" attribute on the <web-app> element.
- Add an empty <absolute-ordering /> element.
<web-app [...] metadata-complete="true">
<absolute-ordering/>
[...]
</web-app>
Upvotes: 2
Reputation: 1368
See if you have sufficient memory or not . There are various reasons that cause tomcat to start slow. In my case it was insufficient memory.
However, you can also configure and increase the memory of tomcat. Increasing memory helps tomcat to occupies some space beforehand .
To do this go to catalina .bat and set-
set CATALINA_OPTS=-Xms1024m -Xmx2048m;
or
set JAVA_OPTS=-Xms2048m -Xmx2048m;
Upvotes: 0