About Tomcat which cannot recognize eclipse work interval Java Web project

Source: Internet
Author: User

 

About Tomcat which cannot recognize eclipse work interval Java Web project

 

1. What types of projects cannot be identified

A) common Java Project

B) web project created under myeclipse

C) web project created under eclipse (damaged)

 

II. Key points for identifying and deploying web projects using tomcat in eclipse

 

All projects have a file to identify themselves (. Project)

In eclipse, A. settings folder is automatically generated when a web project is created. The files in the folder are as follows:

 

These files have their respective functions, especially the following two files:

 

File: org. Eclipse. WST. Common. Project. facet. Core. xml

 

Content:

<? XML version ="1.0"Encoding =UTF-8"?>

<Faceted-Project>

<Runtime name ="Apache Tomcat v5.5"/>

<Fixed facet ="JST. Java"/>

<Fixed facet ="JST. Web"/>

<Installed facet ="JST. Java"Version ="6.0"/>

<Installed facet ="JST. Web"Version ="2.4"/>

<Installed facet ="WST. jsdt. Web"Version ="1.0"/>

</Faceted-Project>

Note: This file identifies the nature of the project and is also a document that Tomcat identifies the project.

 

File: org. Eclipse. WST. Common. Component

 

Content: (post the initial content here)

<? XML version ="1.0"Encoding =UTF-8"?>

<Project-modules id ="Modulecoreid"Project-version ="1.5.0">

<WB-module deploy-name ="Test_eclipse">

<WB-resource deploy-Path ="/"Source-Path ="/Webroot"/>

<WB-resource deploy-Path ="/WEB-INF/classes"Source-Path ="/Src"/>

<Property name ="Context-root"Value ="Test_eclipse"/>

<Property name ="Java-output-path"Value ="/Webroot/WEB-INF/classes"/>

</WB-module>

</Project-modules>

Analysis:

<WB-module deploy-name ="Test_eclipse">

Here, the name of the project deployed to the Web container is "test_eclipse"

<WB-resource deploy-Path ="/"Source-Path ="/Webroot"/>

WB-resource indicates the resources required to run the WEB Project.

<Property name ="Context-root"Value ="Test_eclipse"/>

Context-root indicates that the root directory of the project in the Web container is "test_eclipse"

Property name ="Java-output-path"Value ="/Webroot/WEB-INF/classes"/>

This indicates the path where the files generated by Java compilation are stored.

Note: The resources loaded by deploying the WEB Project in eclipse to Tomcat are determined through this file.

 

 

Iii. Summary

 

Let Tomcat identify the key points of WEB projects

 

1. The project contains. settings, and the org. Eclipse. WST. Common. Project. facet. Core. xml file exists in the folder.

2. Add the following content to the. project file of the project:

<Nature> org. Eclipse. WST. Common. Project. facet. Core. Nature </nature>

 

. Project Content

So that Tomcat can recognize the Eclipse project.

 

Deploy the project to the Tomcat container

In a word, all resources required for project running must be specified in the org. Eclipse. WST. Common. component file.

For example:

 

 

Assume that the project directory structure is as follows:

Modify the org. Eclipse. WST. Common. component file as follows to deploy the jar packages under lib/log4j to Tomcat.

Related Article

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.