Tomcat 8 启动需要很长时间

Tomcat 8 启动需要很长时间

刚刚构建了一个新的 Tomcat 8 应用服务器 (digitalocean droplet)。它是 Ubuntu Server 16.04、openjdk 1.8.0_111、Tomcat 8.0.32 等。从官方 apt repos 安装。没什么特别的。

当我启动服务器时,它会卡在部署 ROOT 应用程序,并且需要 10 分钟才能启动!

INFO: Server startup in 604371 ms

我试过关闭autoDeployunpackWARs,但没什么效果。即便如此,也不应该花 10 分钟……

有人能说出那里发生了什么事吗?

谢谢彼得

    Nov 22, 2016 4:55:22 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
    WARNING: Problem with directory [/usr/share/tomcat8/common/classes], exists: [false], isDirectory: [false], canRead: [false]
    Nov 22, 2016 4:55:22 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
    WARNING: Problem with directory [/usr/share/tomcat8/common], exists: [false], isDirectory: [false], canRead: [false]
    Nov 22, 2016 4:55:22 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
    WARNING: Problem with directory [/usr/share/tomcat8/server/classes], exists: [false], isDirectory: [false], canRead: [false]
    Nov 22, 2016 4:55:22 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
    WARNING: Problem with directory [/usr/share/tomcat8/server], exists: [false], isDirectory: [false], canRead: [false]
    Nov 22, 2016 4:55:22 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
    WARNING: Problem with directory [/usr/share/tomcat8/shared/classes], exists: [false], isDirectory: [false], canRead: [false]
    Nov 22, 2016 4:55:22 PM org.apache.catalina.startup.ClassLoaderFactory validateFile
    WARNING: Problem with directory [/usr/share/tomcat8/shared], exists: [false], isDirectory: [false], canRead: [false]
    Nov 22, 2016 4:55:24 PM org.apache.catalina.core.StandardContext setPath
    WARNING: A context path must either be an empty string or start with a '/' and do not end with a '/'. The path [/] does not meet these criteria and has been changed to []
    Nov 22, 2016 4:55:24 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Valve} Setting property 'resolveHosts' to 'false' did not find a matching property.
    Nov 22, 2016 4:55:24 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host} Setting property 'debug' to '0' did not find a matching property.
    Nov 22, 2016 4:55:24 PM org.apache.catalina.core.StandardContext setPath
    WARNING: A context path must either be an empty string or start with a '/' and do not end with a '/'. The path [/] does not meet these criteria and has been changed to []
    Nov 22, 2016 4:55:24 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
    WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Valve} Setting property 'resolveHosts' to 'false' did not find a matching property.
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.VersionLoggerListener log
    INFO: Server version:        Apache Tomcat/8.0.32 (Ubuntu)
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.VersionLoggerListener log
    INFO: Server built:          Sep 16 2016 13:11:41 UTC
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.VersionLoggerListener log
    INFO: Server number:         8.0.32.0
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.VersionLoggerListener log
    INFO: OS Name:               Linux
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.VersionLoggerListener log
    INFO: OS Version:            4.4.0-47-generic
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.VersionLoggerListener log
    INFO: Architecture:          amd64
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.VersionLoggerListener log
    INFO: Java Home:             /usr/lib/jvm/java-8-openjdk-amd64/jre
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.VersionLoggerListener log
    INFO: JVM Version:           1.8.0_111-8u111-b14-2ubuntu0.16.04.2-b14
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.VersionLoggerListener log
    INFO: JVM Vendor:            Oracle Corporation
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.VersionLoggerListener log
    INFO: CATALINA_BASE:         /var/lib/tomcat8
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.VersionLoggerListener log
    INFO: CATALINA_HOME:         /usr/share/tomcat8
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.VersionLoggerListener log
    INFO: Command line argument: -Djava.util.logging.config.file=/var/lib/tomcat8/conf/logging.properties
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.VersionLoggerListener log
    INFO: Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.VersionLoggerListener log
    INFO: Command line argument: -Djava.awt.headless=true
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.VersionLoggerListener log
    INFO: Command line argument: -Xmx128m
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.VersionLoggerListener log
    INFO: Command line argument: -XX:+UseConcMarkSweepGC
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.VersionLoggerListener log
    INFO: Command line argument: -Djava.endorsed.dirs=/usr/share/tomcat8/endorsed
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.VersionLoggerListener log
    INFO: Command line argument: -Dcatalina.base=/var/lib/tomcat8
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.VersionLoggerListener log
    INFO: Command line argument: -Dcatalina.home=/usr/share/tomcat8
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.VersionLoggerListener log
    INFO: Command line argument: -Djava.io.tmpdir=/tmp/tomcat8-tomcat8-tmp
    Nov 22, 2016 4:55:24 PM org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler ["http-nio-8080"]
    Nov 22, 2016 4:55:24 PM org.apache.tomcat.util.net.NioSelectorPool getSharedSelector
    INFO: Using a shared selector for servlet write/read
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 2462 ms
    Nov 22, 2016 4:55:24 PM org.apache.catalina.core.StandardService startInternal
    INFO: Starting service Catalina
    Nov 22, 2016 4:55:24 PM org.apache.catalina.core.StandardEngine startInternal
    INFO: Starting Servlet Engine: Apache Tomcat/8.0.32 (Ubuntu)
    Nov 22, 2016 4:55:24 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deploying web application directory /var/lib/tomcat8/webapps/ROOT
    Nov 22, 2016 5:05:22 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
    INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [596,561] milliseconds.
    Nov 22, 2016 5:05:22 PM org.apache.catalina.startup.HostConfig deployDirectory
    INFO: Deployment of web application directory /var/lib/tomcat8/webapps/ROOT has finished in 597,690 ms
    Nov 22, 2016 5:05:27 PM org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory getObjectInstance
    WARNING: Name = pcaucrdb Property maxActive is not used in DBCP2, use maxTotal instead. maxTotal default value is 8. You have set value of "50" for "maxActive" property, which is being ignored.
    Nov 22, 2016 5:05:27 PM org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory getObjectInstance
    WARNING: Name = pcaucrdb Property removeAbandoned is not used in DBCP2, use one or both of removeAbandonedOnBorrow or removeAbandonedOnMaintenance instead. Both have default value set to false. You have set value of "true" for "removeAbandoned" property, which is being ignored.
    Nov 22, 2016 5:05:27 PM org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory getObjectInstance
    WARNING: Name = pcaucrdb Property maxWait is not used in DBCP2 , use maxWaitMillis instead. maxWaitMillis default value is -1. You have set value of "10000" for "maxWait" property, which is being ignored.
    Nov 22, 2016 5:05:28 PM 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.
    PCAUCR: Starting context: class util.ContextListener
    Nov 22, 2016 5:05:28 PM org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory getObjectInstance
    WARNING: Name = applicensedb Property maxActive is not used in DBCP2, use maxTotal instead. maxTotal default value is 8. You have set value of "25" for "maxActive" property, which is being ignored.
    Nov 22, 2016 5:05:28 PM org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory getObjectInstance
    WARNING: Name = applicensedb Property removeAbandoned is not used in DBCP2, use one or both of removeAbandonedOnBorrow or removeAbandonedOnMaintenance instead. Both have default value set to false. You have set value of "true" for "removeAbandoned" property, which is being ignored.
    Nov 22, 2016 5:05:28 PM org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory getObjectInstance
    WARNING: Name = applicensedb Property maxWait is not used in DBCP2 , use maxWaitMillis instead. maxWaitMillis default value is -1. You have set value of "10000" for "maxWait" property, which is being ignored.
    Nov 22, 2016 5:05:29 PM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler ["http-nio-8080"]
    Nov 22, 2016 5:05:29 PM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 604371 ms

答案1

找到了答案并且它起作用了......

https://stackoverflow.com/a/26432537/450586

基本上...

转到 JDK/security 文件夹并编辑java.security

就我而言: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/java.security

改变

securerandom.source=file:/dev/random

securerandom.source=file:/dev/./urandom

答案2

使用 free 命令检查可用内存,是否足够,尤其是交换空间?检查日志文件 catalina.out,它显示了什么?

相关内容