Common problems of Tomcat project deployment

Disclaimer: The materials used in this column are written by VIP students of Kaige Academy. Students have the right to remain anonymous and have the right to final interpretation of the article. Kaige Academy aims to promote VIP students to learn from each other based on public notes.

Detailed explanation of creating a web project:
As shown in the figure below, when creating a web project, you need to select a server:

image

As shown in the figure above, you can add multiple servers, which can be tomcat, jboss, etc. Note that the addition of the server tomcat9.0 here does not mean that our project is developed for this server. The addition of this server is only to introduce specifications for developing web projects. We do not necessarily have to run our code on this server: java and The operation principle of servlet and jsp is not implemented, but the specification is put forward for them, just like the interface, the specific implementation is handed over to the container, which will generate a variety of web servers, each of which has its own advantages, users There will also be more options. The specification is not placed in the jdk but on the server, so we add the server to introduce the specification, and then write code based on the specification.

image

If you want to make the project the default project, that is, this project is loaded by default when you enter localhost:8080 on the browser, then you can directly change the project name after publishing on the server to root.

Common problems of project deployment:
The development of the project and the operation of the project on the server are separated. The server will only run the project we deployed on the server. If we deploy the project to the server and then re-modify the project, then The server still runs the original project, because we did not deploy the modified project to the server. But in eclipse, under normal circumstances, eclipse will automatically help us detect whether the project is modified and then synchronize to the server. That is to say, as long as we publish the project to the server, once we modify the project later, eclipse will automatically detect it and help us deploy it to the server synchronously, so that we do not need to publish our modified project to the server again. The server is up. But sometimes there is a problem that the modified content is not displayed on the browser. The solution is as follows:
1. Clean up, as shown in the following figure:

image

2. Restart the server

image

3. Stop the server, delete the deployed project, and then redeploy and run it
. 4. Check whether the port, ip address, project name and requested page name are correct
. For other projects, just run your own project to try, or delete tomcat and decompress a tomcat again
. Note: If you get an error when you start the server, don't panic, see which project is written in the error message, and if it is not currently running The error of the project means that there are errors in other projects, so you can ignore it for the time being.
What is a port:

image

As shown in the figure above, IP is the unique network identifier of the computer. When we want to access the computer, we must hold its IP address. When many network programs are opened in the computer we want to access, as shown in the above figure, Four programs ABCD are opened, and each program occupies a port number (not the same). If you want to access the A program in this computer, you must hold the ip address and the port number corresponding to A to access. , so the port number can be considered to be used to help us identify computer programs, so the port number can only be occupied by a protocol once.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326614364&siteId=291194637