3

Just built a new Tomcat 8 app server (digitalocean droplet). It's Ubuntu Server 16.04, openjdk 1.8.0_111, Tomcat 8.0.32, etc. Installed from official apt repos. Nothing exciting.

When I start the server, it gets stuck deploying the ROOT application and talkes about 10 minutes to start!

INFO: Server startup in 604371 ms

I've tried turning autoDeploy and unpackWARs off but it makes no difference. Even so, should not take 10 minutes...

Can anyone please suggest what's going on in there?

Thanks Peter

    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
PrecisionPete
  • 231
  • 3
  • 10
  • A quick google search of the line that clearly took the bulk of the time (INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took) brought me to: [Official Tomcat site: Faster Startup: Entropy Source](https://wiki.apache.org/tomcat/HowTo/FasterStartUp#Entropy_Source) –  Nov 22 '16 at 22:30
  • I did try that but it wasn't clear where it goes. I thought I figure out where but it didn't work. Did find the answer below... – PrecisionPete Nov 22 '16 at 22:38

2 Answers2

4

Found the answer and it worked...

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

Basically...

Go to the JDK/security folder and edit java.security

in my case: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/java.security

Change

securerandom.source=file:/dev/random

to

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

PrecisionPete
  • 231
  • 3
  • 10
0

Check available memory with free command, is there enough, especially swap space? Check the log file, catalina.out, what does it show?