title: Tomcat7 starts too late on Ubuntu 14.04 x64 [Digitalocean]
body: <p>i am using digitalocean and trying to install and start tomcat on ubuntu but unfortunately i can not do it. (created new droplets and tried 10 times)</p>
  
  <p><strong><em>1GB Ram 30GB SSD Disk Amsterdam 2 Ubuntu 14.04 x64</em></strong></p>
  
  <p>When i start tomcat, it says "Tomcat started". But i can not access page from browser. and ./shutdown.sh returns error. </p>
  
  <p>What can be the problem ? </p>
  
  <p><strong>I noticed something now. While i am writing this question, tomcat page is displayed. it took 28 minutes to display the page</strong> </p>
  
  <p>catalina.out says: <strong>INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [1,718,769] milliseconds.</strong></p>
  
  <p>Here are my installation steps (These steps works on different vps but doesn't work on digitalocean droplets):</p>
  
  <p>Install oracle jdk</p>
  
  <pre><code> sudo apt-get install python-software-properties
   sudo add-apt-repository ppa:webupd8team/java
   sudo apt-get update
   sudo apt-get install oracle-java7-installer
   sudo apt-get install oracle-java7-set-default
        java -version
        java version "1.7.0_72"
        Java(TM) SE Runtime Environment (build 1.7.0_72-b14)
        Java HotSpot(TM) 64-Bit Server VM (build 24.72-b04, mixed mode)
  </code></pre>
  
  <p>Set java path</p>
  
  <pre><code>      sudo nano /etc/environment
        JAVA_HOME="/usr/lib/jvm/java-7-oracle"
        source /etc/environment
        wget http://ftp.itu.edu.tr/Mirror/Apache/tomcat/tomcat-7/v7.0.56/bin/apache-tomcat-7.0.56.tar.gz
        tar xvzf apache-tomcat-7.0.56.tar.gz
        mv apache-tomcat-7.0.56/ apache-tomcat-7.0.56-server-1/
  </code></pre>
  
  <p>Start Tomcat</p>
  
  <pre><code>        ./startup.sh
              Using CATALINA_BASE:   /usr/local/apache-tomcat-7.0.56-server-1
              Using CATALINA_HOME:   /usr/local/apache-tomcat-7.0.56-server-1
              Using CATALINA_TMPDIR: /usr/local/apache-tomcat-7.0.56-server-1/temp
              Using JRE_HOME:        /usr/lib/jvm/java-7-oracle/jre
              Using CLASSPATH:       /usr/local/apache-tomcat-7.0.56-server-1/bin/bootstrap.jar:/usr/local/apache-tomcat-7.0.56-server-1/bin/tomcat-juli.jar
              Tomcat started.
  </code></pre>
  
  <p>Checkout Port 8080  </p>
  
  <pre><code>        netstat -ln 
              tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
              tcp6       0      0 :::8009                 :::*                    LISTEN
              tcp6       0      0 :::8080                 :::*                    LISTEN
              tcp6       0      0 :::22                   :::*                    LISTEN
  </code></pre>
  
  <p>Checkout process</p>
  
  <pre><code>            ps -ef | grep tomcat
              root      2825     1  1 14:23 pts/0    00:00:03 /usr/lib/jvm/java-7-oracle/jre/bin/java -Djava.util.logging.config.file=/usr/local/apache-tomcat-7.0.56-server-1/conf/logging.properties -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.endorsed.dirs=/usr/local/apache-tomcat-7.0.56-server-1/endorsed -classpath /usr/local/apache-tomcat-7.0.56-server-1/bin/bootstrap.jar:/usr/local/apache-tomcat-7.0.56-server-1/bin/tomcat-juli.jar -Dcatalina.base=/usr/local/apache-tomcat-7.0.56-server-1 -Dcatalina.home=/usr/local/apache-tomcat-7.0.56-server-1 -Djava.io.tmpdir=/usr/local/apache-tomcat-7.0.56-server-1/temp org.apache.catalina.startup.Bootstrap start
  </code></pre>
  
  <p>Open web site at port 8080 <code>http://5.101.107.56:8080/</code>  Page is waiting... [content is displayed after 28 minute or more]</p>
  
  <p>Try to shutdown tomcat if content is not displayed yet (before tomcat starts properly).</p>
  
  <pre><code>      ./shutdown.sh 
              SEVERE: Could not contact localhost:8005. Tomcat may not be running.
              Oct 17, 2014 2:40:29 PM org.apache.catalina.startup.Catalina stopServer
              SEVERE: Catalina.stop:
                  java.net.ConnectException: Connection refused
                  at java.net.PlainSocketImpl.socketConnect(Native Method)
                  at java.net.AbstractPlainSoc
  </code></pre>
  
  <p>Checkout logs</p>
  
  <pre><code>      catalina.out
              Oct 17, 2014 2:31:47 PM org.apache.coyote.AbstractProtocol init
              INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
              Oct 17, 2014 2:31:47 PM org.apache.catalina.startup.Catalina load
              INFO: Initialization processed in 1492 ms
              Oct 17, 2014 2:31:47 PM org.apache.catalina.core.StandardService startInternal
              INFO: Starting service Catalina
              Oct 17, 2014 2:31:47 PM org.apache.catalina.core.StandardEngine startInternal
              INFO: Starting Servlet Engine: Apache Tomcat/7.0.56
              Oct 17, 2014 2:31:47 PM org.apache.catalina.startup.HostConfig deployDirectory
              INFO: Deploying web application directory /usr/local/apache-tomcat-7.0.56-server-1/webapps/host-manager
  </code></pre>
  
  <p>I also installed nginx and navigate to <code>http://5.XXX.XXX.XX/</code> nginx welcome page is opened immediately</p>
  
  <p>I checked catalina.out when i see the page in browser, it says: </p>
  
  <pre><code>    Oct 17, 2014 2:31:47 PM org.apache.catalina.startup.HostConfig deployDirectory
      INFO: Deploying web application directory /usr/local/apache-tomcat-7.0.56-server-1/webapps/host-manager
      Oct 17, 2014 3:00:27 PM org.apache.catalina.util.SessionIdGenerator createSecureRandom
      INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took **[1,718,769] milliseconds.**
  </code></pre>
  
  <p>Memory:</p>
  
  <pre><code>               total       used       free     shared    buffers     cached
    Mem:       1017912     849512     168400        332      18780     688468
  </code></pre>