大家好的一天,我目前正在使用Tomcat 8,并且在加载项目方面面临困难。主要问题是进入网站需要3-5分钟。而通常只需10秒即可加载。
以前没有这样的问题,今天只发生随机发生。我试图通过将下面的代码添加到context.xml中来禁用JAR扫描仪。根据日志中的时间戳,扫描大部分时间都在消耗。这是我唯一能找到的解决方案,但是这无效。请让我知道是否还有其他解决方案,非常感谢! :)
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>
日志上显示的另一个警告是
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
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
发布评论
评论(2)
尝试这篇文章:
对我而言,第一个建议给出了显着改进:从〜4分钟到开始时间的〜1分钟,加速。
这将禁用对注释的罐子的扫描,因此,只有当您的应用程序足够简单以将所有Servlet配置保存在Web.xml中时,这才有意义。
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.
看看您是否有足够的内存。有多种原因导致Tomcat开始缓慢。就我而言,这是不足的记忆。
但是,您还可以配置和增加Tomcat的内存。增加的内存有助于托马猫事先占用一些空间。
要这样做
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-