Beginner Web Development, today installed a tomcat, runs normally, but when the access is displayed blank page, and in the log
A similar error occurred in Localhost_access_log.xxxx-xx-xx.txt:
192.168.1.100--[15/apr/2016:19:48:58 +0800] "get/examples/index.html http/1.1" 200 1253
Baidu for a few hours did not solve the problem, finally open the installation package running instructions (RUNNING.txt), re-download the JRE and installed to resolve the problem.
Previously installed JRE is actually intended for normal users, can provide a running environment, but no development environment, so if you open this JRE directory can only find bin and lib2 subdirectories.
If using Yum view: Yum List | grep java
Java-1.7.0-openjdk-1.7.0.85-2.6.1.3.el6_7.x86_64
This is the JDK development package, which contains a JRE, but this JRE cannot be used for development, otherwise the above error will occur.
A TOMCAT7 installation instructions are attached below
Here take apache-tomcat-7.0.68.tar.gz as an example
You can download TOMCAT7 from here
Here are the official documents of TOMCAT7.
Unzip after download, there is a RUNNING.txt directory, here are the installation instructions:
First, the operating environment
Download the JDK Java Development Kit (JDK) and install
The JRE must be version 6 and later. JRE download
Note that the JRE installed here is a separate installation package, not the one that the JDK carries, and if you do not install a separate JRE installation package, although you can start Tomcat, a blank page appears when the browser accesses it and
An error similar to the following appears in the Localhost_access_log.xxxx-xx-xx.txt file:
192.168.1.181--[15/apr/2016:16:41:17 +0800] "get/sample/index.html http/1.1" 404-
Two, install Tomcat.
The tomcat downloaded here is apache-tomcat-7.0.68.tar.gz.
Unzip to the/usr/local/apache-tomcat-7.0.68.
Third, set environment variables
If the JRE installed is jre-8u77-linux-x64.rpm, it is installed in the/usr/java/jre1.8.0_77/directory.
The JDK installed is java-1.7.0-openjdk-1.7.0.85-2.6.1.3.el6_7.x86_64, installed in the/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.85.x86_64
Environment variables that must be set:
Catalina_home= "/usr/local/apache-tomcat-7.0.68"
Jre_home= "/usr/java/jre1.8.0_77/"
Java_home= "/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.85.x86_64"
Environment variables for optional settings:
Catalina_base= "/usr/share/apache-tomcat-7.0.68"
You can set the value to use Catalina_home, if not set. The best setting.
Other such as Java_opts,catalina_opts,catalina_pid, it is best not to set.
Four, start Tomcat:
$CATALINA _home/bin/startup.sh or $CATALINA _home/bin/catalina.sh start
You can see the following output:
Using catalina_base:/usr/local/apache-tomcat-7.0.68
Using Catalina_home:/usr/local/apache-tomcat-7.0.68
Using Catalina_tmpdir:/usr/local/apache-tomcat-7.0.68/temp
Using Jre_home:/usr/java/jre1.8.0_77/
Using CLASSPATH:/usr/local/apache-tomcat-7.0.68/bin/bootstrap.jar:/usr/local/apache-tomcat-7.0.68/bin/ Tomcat-juli.jar
Tomcat started.
You need to be aware of permissions for firewalls and related directories. If all is set up properly, access in the browser:
Http://192.168.1.210:8080/examples/index.html
You can see the normal page
This article is from the "01 Small Build" blog, please make sure to keep this source http://jetyi.blog.51cto.com/1460128/1764291
404 error due to missing JRE