Integrating Tomcat in Eclipse

question:

Many times after starting Tmocat in Eclipse, the localhost:8080 home page of the machine cannot be accessed, and other projects cannot be accessed.

reason:

After opening the webapp under Tomcat, the project directory is also found. This is because Eclipse redirects the release path and does not put it in the webapp under tomcat.

solve:

Integrate Tomcat in Eclipse, and be able to access localhost:8080 and the project website after starting in Eclipse.

1. Create a new server

File->New->Other->Server->Server->Next

 

My tomcat is 7.0.35, select Tomcat v6.0 Server under Apache, create a Server Name and click Next

 

Configure Server in the pop-up dialog box, configure the Tomcat installation path and select the corresponding Jre, and click Finish. (Next will let you choose the project to run, you don't have to choose it first)

OK, a Server is created.

2. Configure the deployment path

Double-click the newly built Tomcat v7.0 in the Server window of Eclipse, and the configuration interface appears.

You can see that Use workspace metadata (does not modify Tomcat installion) is selected in the above picture

If the project is deployed in the tomcat, the options in the red circle will be grayed out and cannot be modified. To modify, you must first remove the deployed services in the tomcat.

(The modification method is to right-click the newly created Tomcat v7.0 in the Server window and select Add and Remove)

 

选择Use tomcat installation(Task control of Tomcat installation)

That is, select the installation directory of tomcat as the release directory of the project. After selecting this item, the Server path will become the installation directory of tomcat.

接下来,有个Deploy path部署目录,默认是wtpwebapps,改成tomcat的发布目录webapps

改完配置后保存关闭,在Eclipse中启动新建的tomcat v7.0后,就可以正常访问localhost:8080了。

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326165587&siteId=291194637