One of the most inconvenient ways to switch from myeclipse to eclipse is to deploy a web project. I am always wondering why I can't port myeclipse, or whether someone else can develop one based on myeclipse.
The original version of eclipse comes with WTP, and WTP's Web application server management function is still available, but it is somewhat complicated.
It takes some time to learn how to use it easily. After learning, it is quite convenient.
Currently, Tomcat management plug-ins in eclipse are not found.
One of the old plug-ins is tomcatplugin v321, and only one Tomcat can be managed, which is insufficient in quantity.
Therefore, using the built-in WTP in eclipse is also a way out.
(This article is for eclipse 3.6 J2EE)
I. Web Application Server Management Function of WTP
----------------------------------------------------------------------------
WTP supports almost all web application servers. For more information about the types of Web application servers supported, see.
If the Web application server you want is not included, click "download additional Serer adapters" in the image to add other web application servers.
.
WTP has many Web application server management functions, and it is still a bit complicated to Control. Next we will learn how to control it.
Use it to publish my web applicationsProgramTo Tomcat and run it, stop, restart, start Tomcat in debugging mode, clean up and release, and so on.
Ii. install Tomcat
----------------------------------------------------------------------------
1. Extract the two decompressed versions of tomcat6 to the local hard disk.
There are many parallel projects and different JNDI data sources, so two Tomcat
JDK, and java_home environment variables have been correctly configured
Specific operation, omitted.
2. Configure the two Tomcat servers in eclipse, for example:
3. Create a tomcat management configuration project for WTP
----------------------------------------------------------------------------
Open the servers view of Eclipse. Right-click the blank area and select "new" -- "server" to create the Tomcat management configuration for WTP.
I have added two WTP Tomcat server management configuration items.
When you delete the WTP Tomcat server management configuration item, you must stop all Tomcat servers before they can succeed. Otherwise, an error is reported and there is a residue.
At the same time, a "project" called servers is added to the "package View", which is in parallel with our self-developed projects. The tomcat configuration files are all here. If you want to modify the tomcat configuration file, modify it here. Do not directly modify the configuration file of the original tomcat installation directory.
We press the "publish to the server" button in the servers view to synchronize the tomcat configuration file managed by eclipse to the physical Tomcat directory.
There are two situations:
1. Synchronize the tomcat configuration file managed by eclipse to the physical installation directory of Tomcat.
2. Synchronize the tomcat configuration file managed by eclipse to a deep directory (deep) of eclipse. Tomcat starts with this configuration file, without modifying the configuration file of the original tomcat installation directory.
We have selected 1st types at the end.
In the "package View", this "project" called servers can be deleted. When the Tomcat server management configuration project of WTP fails to be deleted, delete the "project" called servers in "package View ". When you create a WTP Tomcat server management configuration project, it will be released again.
4. Configure the WTP Tomcat server management configuration item
----------------------------------------------------------------------------
In the servers view, double-click the newly added WTP Tomcat server management configuration item to open the following interface:
A few red parts are important.
The default situation is:
If you do not modify the default value here, you can publish the web application to Tomcat and start running. The default value is as follows:
Synchronize the tomcat configuration file managed by eclipse to an eclipse directory (deep). Tomcat starts with this configuration file without modifying the configuration file of the original tomcat installation directory.
When a project is released, a compiled project is copied.CodeGo to the \. Metadata \. plugins \ org. Eclipse. WST. server. Core \ tmpn \ wtpwebapps \ directory.
We need to change it:
Here we need to modify it to enhance control over tomcat. Sometimes we need to go to the physical installation directory of Tomcat to do some work. To be changed:
Synchronize the tomcat configuration file managed by eclipse to the conf directory in the physical installation directory of Tomcat, overwrite the configuration file in the conf directory of the original tomcat installation directory, and enhance Tomcat control.
When a project is released, a compiled project code is copied to the webapps directory of Tomcat's physical installation directory.
Note:
As you can see, several key options are gray and cannot be operated, because there are released projects in the WTP Tomcat server management configuration project.
First, clear the previously released project to perform the operation. Modify the image as shown in the image to achieve the goal.
V. Operation Management
--------------------------------------------------------------
In the servers view, right-click the Tomcat server management configuration project of WTP. The menu is as follows:
You can manage Tomcat running.
You do not need to stop the instance before restarting. Simply press start.
The "server" icon in the red line is "publish to the server". It is used to publish the tomcat configuration file and is very important.
6. Resolving project problems cannot be released
----------------------------------------------------------------------
Only "dynamic web projects" can be "published" to Tomcat. If your project cannot be "published", it is not "Dynamic Web project ".
Adjust as follows:
Right-click the item and select properties. The following window is displayed. set it to "Dynamic Web project" according to the operation ".
If the "target runtime cannot be found" error is reported during compilation, press and set "target RunTime ". You can.
7. debugging Java code frequent restart
----------------------------------------------------------------------
On the Tomcat server, double-click to edit the server, select your project on the modules tab, click Edit to remove the reload context, and then run the server on a virtual machine above jdk1.4, you can directly use hotswap without restarting it.