Tomcat7在Ubuntu 14.04 x64上启动太晚[Digitalocean] [英] Tomcat7 starts too late on Ubuntu 14.04 x64 [Digitalocean]

查看:138
本文介绍了Tomcat7在Ubuntu 14.04 x64上启动太晚[Digitalocean]的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用digitalocean并试图在ubuntu上安装和启动tomcat但不幸的是我不能这样做。 (创造了新的水滴并尝试了10次)

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)

1GB Ram 30GB SSD Disk Amsterdam 2 Ubuntu 14.04 x64

1GB Ram 30GB SSD Disk Amsterdam 2 Ubuntu 14.04 x64

当我启动tomcat时,它说Tomcat启动。但我无法从浏览器访问页面。和./shutdown.sh返回错误。

When i start tomcat, it says "Tomcat started". But i can not access page from browser. and ./shutdown.sh returns error.

可能是什么问题?

我现在注意到了一些事情。我正在写这个问题时,会显示tomcat页面。显示页面需要28分钟

catalina.out说:信息:使用[SHA1PRNG]创建会话ID生成的SecureRandom实例[1,718,769]毫秒。

catalina.out says: INFO: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [1,718,769] milliseconds.

以下是我的安装步骤(这些步骤适用于不同的vps,但不适用于digitalocean飞沫):

Here are my installation steps (These steps works on different vps but doesn't work on digitalocean droplets):

安装oracle jdk

Install oracle jdk

 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)

设置java路径

      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/

启动Tomcat

        ./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.

Checkout Port 8080

Checkout Port 8080

        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

结帐流程

            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

在8080端口打开网站 http://5.101.107.56:8080/ 页面正在等待... [内容在28分钟或更长时间后显示]

Open web site at port 8080 http://5.101.107.56:8080/ Page is waiting... [content is displayed after 28 minute or more]

如果内容尚未显示(在tomcat正常启动之前),请尝试关闭tomcat。

Try to shutdown tomcat if content is not displayed yet (before tomcat starts properly).

      ./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

结帐日志

      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

我还安装了nginx并导航到 http://5.XXX.XXX.XX/ nginx欢迎页面立即打开

I also installed nginx and navigate to http://5.XXX.XXX.XX/ nginx welcome page is opened immediately

我检查了catalina.out时我在浏览器中看到该页面,它说:

I checked catalina.out when i see the page in browser, it says:

    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.**

记忆:

               total       used       free     shared    buffers     cached
  Mem:       1017912     849512     168400        332      18780     688468


推荐答案

替换 securerandom.source = file:/ dev / urandom securerandom.source = file:/ dev /./ urandom $ JAVA_PATH / jre / lib / security / java.security 已解决了我的问题。

Replacing securerandom.source=file:/dev/urandom with securerandom.source=file:/dev/./urandom in $JAVA_PATH/jre/lib/security/java.security has solved my problem.

即使指定了文件:/ dev / urandom ,JRE仍将使用 / dev / random 作为SHA1PRNG (请参阅 JDK-4705093 ):

Even when file:/dev/urandom is specified, JRE will still use /dev/random for SHA1PRNG (see bug JDK-4705093):


在SHA1PRNG中,有一个SeedGenerator可以根据配置执行各种

In SHA1PRNG, there is a SeedGenerator which does various things depending on the configuration.


  1. 如果java.security.egd或securerandom.source指向file:/ dev / random或file:/ dev / urandom,我们将使用
    NativeSeedGenerator,它调用super()叫
    SeedGenerato r.URLSeedGenerator(的/ dev /随机的)。 (
    SeedGenerator中的嵌套类。)此bug中唯一发生变化的是
    urandom也会触发使用此代码路径。

  1. If java.security.egd or securerandom.source point to "file:/dev/random" or "file:/dev/urandom", we will use NativeSeedGenerator, which calls super() which calls SeedGenerator.URLSeedGenerator(/dev/random). (A nested class within SeedGenerator.) The only things that changed in this bug was that urandom will also trigger use of this code path.

如果这些属性指向另一个存在的URL,我们将初始化SeedGenerator.URLSeedGenerator(url)。这就是
file:/// dev / urandom,file:/./ dev / random等的原因。

If those properties point to another URL that exists, we'll initialize SeedGenerator.URLSeedGenerator(url). This is why "file:///dev/urandom", "file:/./dev/random", etc. will work.


来自维基百科/ dev /随机


在此实现中,生成器保持估计噪声位数
熵池。从这个熵池中创建随机的
数字。读取时,/ dev / random设备只会
返回熵池
中估计噪声位数内的随机字节。 / dev / random 应该适合需要
非常高质量的随机性的用户,例如一次性密码或密钥生成。

In this implementation, the generator keeps an estimate of the number of bits of noise in the entropy pool. From this entropy pool random numbers are created. When read, the /dev/random device will only return random bytes within the estimated number of bits of noise in the entropy pool. /dev/random should be suitable for uses that need very high quality randomness such as one-time pad or key generation.

当熵池为空时,从/ dev / random 中读取将阻止
,直到收集到其他环境噪音。
意图是
作为加密安全的伪随机数生成器,
提供尽可能大的熵输出。建议使用
来生成用于高价值或长期
保护的加密密钥。

When the entropy pool is empty, reads from /dev/random will block until additional environmental noise is gathered. The intent is to serve as a cryptographically secure pseudorandom number generator, delivering output with entropy as large as possible. This is suggested for use in generating cryptographic keys for high-value or long-term protection.

环境噪音?


随机数生成器从设备
驱动程序和其他来源收集环境噪音 进入熵池。生成器还
保持对熵池中噪声位数的估计。
从这个熵池中创建随机数。

The random number generator gathers environmental noise from device drivers and other sources into an entropy pool. The generator also keeps an estimate of the number of bits of noise in the entropy pool. From this entropy pool random numbers are created.

这意味着在实践中,可以阻止tomcat未知的时间。

这篇关于Tomcat7在Ubuntu 14.04 x64上启动太晚[Digitalocean]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆