Tomcat的不是在Amazon

Tomcat的不是在Amazon

本文介绍了Tomcat的不是在Amazon EC2上,红帽实例上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个Java应用程序开发人员,不知道很多关于Linux配置。

I'm a java application developer, and don't know much about linux configuration.

我试图安装Java和Tomcat能够在Amazon EC2上一个新的红帽实例,执行下面的脚本。

I'm trying to install Java and Tomcat to a fresh Redhat instance on Amazon EC2, and executed the below script.

mkdir /usr/local/java
cd /usr/local/java
curl http://download.oracle.com/otn-pub/java/jdk/7u2-b13/jdk-7u2-linux-i586.rpm > jdk.rpm
rpm -iv jdk.rpm

updatedb; locate javac | grep bin  # this step merely serves to verify the installation
/usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_02/bin/java 100
/usr/sbin/alternatives --install /usr/bin/jar jar /usr/java/jdk1.7.0_02/bin/jar 100
/usr/sbin/alternatives --install /usr/bin/javac javac /usr/java/jdk1.7.0_02/bin/javac 100
/usr/sbin/alternatives --config java
updatedb

mkdir /env
mkdir /env/tomcat
cd /env/tomcat
curl http://www.gtlib.gatech.edu/pub/apache/tomcat/tomcat-7/v7.0.23/bin/apache-tomcat-7.0.23.tar.gz > apache-tomcat-7.0.23.tar.gz
tar zxvf apache-tomcat-7.0.23.tar.gz
cd apache-tomcat-7.0.23
bin/startup.sh #

在这一点上,的http:// ec2-23 -20-24-96.compute-1.amazonaws.com:8080/ 预计将回到Tomcat的主页,但事实并非如此:(

At this point, http://ec2-23-20-24-96.compute-1.amazonaws.com:8080/ was expected to return Tomcat homepage, but it didn't :(

cd /etc/rc.d/init.d/
vi tomcat

我粘贴下面的内容到文件中:

I pasted the below content to the file:

#!/bin/sh
# Tomcat init script for Linux.
#
# chkconfig: 2345 96 14
# description: The Apache Tomcat servlet/JSP container.

JAVA_HOME=/usr/java/jdk1.7.0_02
CATALINA_HOME=/env/tomcat/apache-tomcat-7.0.23
export JAVA_HOME CATALINA_HOME

exec $CATALINA_HOME/bin/catalina.sh $*

然后执行:

chmod 755 /etc/rc.d/init.d/tomcat
chkconfig --level 2345 tomcat on

export JAVA_HOME=/usr/java/jdk1.7.0_02
export PATH=$PATH:/usr/java/jdk1.7.0_02
export CATALINA_HOME=/env/tomcat/apache-tomcat-7.0.23

/env/tomcat/apache-tomcat-7.0.23/bin/shutdown.sh
/env/tomcat/apache-tomcat-7.0.23/bin/startup.sh

无处没有我得到任何的错误,但我也无法得到Tomcat的主页显示。可以引导哪里哪里我出了问题。

Nowhere did I get any error, but I also couldn't get the Tomcat homepage to display.Can you guide where where I went wrong.

感谢
詹姆斯

编辑:

Tomcat的日志(在停止和启动服务器)

Tomcat log (on stopping and starting server)

Jan 18, 2012 2:06:48 AM org.apache.catalina.core.StandardServer await
INFO: A valid shutdown command was received via the shutdown port. Stopping the Server instance.
Jan 18, 2012 2:06:48 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-bio-8080"]
Jan 18, 2012 2:06:48 AM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-bio-8009"]
Jan 18, 2012 2:06:48 AM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
Jan 18, 2012 2:06:48 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["http-bio-8080"]
Jan 18, 2012 2:06:48 AM org.apache.coyote.AbstractProtocol stop
INFO: Stopping ProtocolHandler ["ajp-bio-8009"]
Jan 18, 2012 2:06:48 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-bio-8080"]
Jan 18, 2012 2:06:48 AM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
Jan 18, 2012 2:08:46 AM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/java/packages/lib/i386:/lib:/usr/lib
Jan 18, 2012 2:08:46 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jan 18, 2012 2:08:46 AM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jan 18, 2012 2:08:46 AM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 530 ms
Jan 18, 2012 2:08:46 AM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jan 18, 2012 2:08:46 AM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.23
Jan 18, 2012 2:08:46 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /env/tomcat/apache-tomcat-7.0.23/webapps/examples
Jan 18, 2012 2:08:47 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /env/tomcat/apache-tomcat-7.0.23/webapps/host-manager
Jan 18, 2012 2:08:47 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /env/tomcat/apache-tomcat-7.0.23/webapps/manager
Jan 18, 2012 2:08:47 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /env/tomcat/apache-tomcat-7.0.23/webapps/docs
Jan 18, 2012 2:08:47 AM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory /env/tomcat/apache-tomcat-7.0.23/webapps/ROOT
Jan 18, 2012 2:08:47 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jan 18, 2012 2:08:47 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jan 18, 2012 2:08:47 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 583 ms

EDIT2:

我的问题看起来与一个在 HTTPS://forums.aws。 amazon.com/thread.jspa?threadID=59937 ,但没有提供解决方案。

My problem looks similar to the one on https://forums.aws.amazon.com/thread.jspa?threadID=59937, but that provides no solution.

我进行了wget的,我收到了适当的index.html与Tomcat的html网页。
    wget的的http:// ec2-23-20-24-96。 compute-1.amazonaws.com:8080

I performed a wget, and I received a proper index.html with Tomcat homepage html.
wget http://ec2-23-20-24-96.compute-1.amazonaws.com:8080

我有两个安全组 - 默认情况下,快速启动-1,和我已经添加了80和8080端口的列表

I have two security groups - default and quick-start-1, and I've added ports 80 and 8080 to the list.

推荐答案

从AWS支持帮助解决了这个问题:

Solved it with help from AWS Support:

您好

它最初看起来像iptables的是在您的实例中运行,我的支票秀过滤的端口,你将需要添加一个规则,允许8080端口,或禁用该实例本身的防火墙。

It initially looks like iptables is running on your instance, my checks show filtered ports, you will need to add a rule to allow port 8080, or disable the firewall on the instance itself.

您可以通过以root身份运行服务iptables的停止,然后看看你是否可以连接到端口8080进行验证。

You can verify this by running as root "service iptables stop" and then see if you can connect on port 8080.

亲切的问候
    AndyC

Kind Regards
AndyC

链接: https://forums.aws.amazon.com /thread.jspa?messageID=312167&#312167

这篇关于Tomcat的不是在Amazon EC2上,红帽实例上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 03:24