Learn Java--tomcat installation and common error Troubleshooting (ZZ) starting from 0

Source: Internet
Author: User
Tags tomcat server

Source: <Http://www.cnblogs.com/xdp-gacl/p/3729033.html >
Learn Web development, why do you have to install a Web server first?

Creating a Web page on the local computer is not accessible to the user, but if you start the Tomcat server and place the Web page on the Tomcat server, the user will be able to access it. What does that mean?
1, no matter what web resources, want to be accessed by a remote computer, must have a corresponding network communication program, when the user to access, the network communication program read the Web resource data, and send the data to the visitors .
2, Web server is such a program, it is used to complete the underlying network communication. Using these servers, we developers need to focus on how the Web resources are written, without caring how the resources are sent to the client, greatly reducing developer effort.

1. Download and install the Tomcat server

Tomcat Official site: http://jakarta.apache.org

Download the Tomcat installer package: http://tomcat.apache.org/

  

Click "Download" to jump to the download page as shown

    1. tar.gz files are installed under the Linux operating system
    2. EXE file is the installation version under Windows system
    3. ZIP file is a compressed version under Windows system

After the download is complete, a compressed package is obtained, and the compressed package can be unpacked to complete the installation of the Tomcat server.

  

After extracting the compressed package, you get the folder as shown, which completes the installation of the Tomcat server.

 

2. Start and test the Tomcat server

  

Start the Tomcat server

Double-click the Startup.bat file in the bin directory to start the Tomcat server

    

      

Testing the Tomcat server

Open the browser, enter http://localhost:8080/, can display the following interface to indicate the successful installation.

    

3. Tomcat Startup FAQ

The reason why the Tomcat server does not start properly is generally the following two:

1, Java_home environment variable setting problem

To double-click the Startup.bat file in the bin directory to start the Tomcat server, the first thing to do is to set the JAVA_HOME environment variable in Windows, because the Tomcat server starts with this java_home environment variable, If the JAVA_HOME environment variable does not exist in Windows, the Tomcat server cannot be started.

Configuring the Java_home variable in window

Operation Steps (Win7 system): Computer → right Button "Properties" → advanced system settings → advanced → environment variables as shown:

   




Click " New " Under the system variable, pop up a new system Variable dialog box, first in the variable name write Java_home, as the name implies, the meaning of Java_home is the JDK installation path, and then in the variable value to write the JDK installation path, If the variable value set here is "D:\Program Files (x86) \java\jdk1.7.0", after setting the value of the variable, click the "OK" button, the JAVA_HOME environment variable is set to complete, as shown in: System variable more than one " Java_home "variable.


Normally, the first step in learning JAVA development is to configure the PATH environment variable, which is better configured by first configuring the JAVA_HOME environment variable and then using "%java_home%" in the path variable to refer to the value of the Java_home variable.


So this java_home environment variable is usually configured in window, and if you forget to configure the JAVA_HOME environment variable, you can configure it in the way described above

2. Port occupancy Issues

Because the Tomcat server starts with a default of 8080 port, if the 8080 port is occupied by another application, then the Tomcat server will not start properly, the phenomenon is that "the Tomcat server boot interface will print an exception error message, and then automatically shut down the "As shown in:

 

Since this window is very short from start to close, it is difficult to see the error message when Tomcat starts, so we can only check the Tomcat server's operation through the log (log) information of the Tomcat server.

There is a logs folder under the root directory of the Tomcat server,

 

Logs folder for Tomcat log files, open the Logs folder, you can see the log file inside, which has a "catalina.yyyy-mm-dd.log" form named log file, for example " Catalina.2014-05-17.log "Log files are the records of the day that Tomcat server 2014-05-17 is running.

  

Open the Catalina.2014-05-17.log file to see the log information inside,

  

Log information is clearly recorded in the operation of the Tomcat server, if the 8080 port is occupied and can not start properly, the exception is recorded as shown in the information, by looking at the exception information, we can know why the Tomcat server can not start properly!

Summary: When the Tomcat server fails to start correctly, first check that the JAVA_HOME environment variable is configured, and then check that the port on which the Tomcat server was started is being consumed by another application.



 

From for notes (Wiz)

Learn Java--tomcat installation and common error Troubleshooting (ZZ) starting from 0

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.