title: Tomcat not running on Amazon EC2, Redhat Instance
body: <p>I'm a java application developer, and don't know much about linux configuration.</p>
  
  <p>I'm trying to install Java and Tomcat to a fresh Redhat instance on Amazon EC2, and executed the below script.</p>
  
  <pre><code>mkdir /usr/local/java
  cd /usr/local/java
  curl http://download.oracle.com/otn-pub/java/jdk/7u2-b13/jdk-7u2-linux-i586.rpm &gt; 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 &gt; 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 # 
  </code></pre>
  
  <p>At this point, <a href="http://ec2-23-20-24-96.compute-1.amazonaws.com:8080/" rel="nofollow">http://ec2-23-20-24-96.compute-1.amazonaws.com:8080/</a> was expected to return Tomcat homepage, but it didn't :(</p>
  
  <pre><code>cd /etc/rc.d/init.d/
  vi tomcat
  </code></pre>
  
  <p>I pasted the below content to the file:</p>
  
  <pre><code>#!/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 $*
  </code></pre>
  
  <p>Then executed:</p>
  
  <pre><code>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
  </code></pre>
  
  <p>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.</p>
  
  <p>Thanks<br>
  James</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Tomcat log (on stopping and starting server)</p>
  
  <pre><code>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
  </code></pre>
  
  <p><strong>EDIT2:</strong></p>
  
  <p>My problem looks similar to the one on <a href="https://forums.aws.amazon.com/thread.jspa?threadID=59937" rel="nofollow">https://forums.aws.amazon.com/thread.jspa?threadID=59937</a>, but that provides no solution.</p>
  
  <p>I performed a wget, and I received a proper index.html with Tomcat homepage html.<br>
      wget <a href="http://ec2-23-20-24-96.compute-1.amazonaws.com:8080" rel="nofollow">http://ec2-23-20-24-96.compute-1.amazonaws.com:8080</a></p>
  
  <p>I have two security groups - default and quick-start-1, and I've added ports 80 and 8080 to the list.</p>