This Bugzilla instance is deprecated, and most Eclipse projects now use GitHub or Eclipse GitLab. Please see the deprecation plan for details.
Bug 304845 - Error when removing projects from the server
Summary: Error when removing projects from the server
Status: RESOLVED NOT_ECLIPSE
Alias: None
Product: WTP ServerTools
Classification: WebTools
Component: wst.server (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Angel Vera CLA
QA Contact: Angel Vera CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-03-05 12:04 EST by Steven Hung CLA
Modified: 2010-03-11 14:30 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Steven Hung CLA 2010-03-05 12:04:31 EST
Build Identifier: I20100302-0800

After adding a project to the server and running a simple servlet, when I try to remove the project I get the error:

Error
Fri Mar 05 11:54:14 EST 2010
Could not delete D:\wtp\eclipse\workspace\smk\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\DynamicWebProject\WEB-INF\lib\JavaProject.jar. May be locked by another process.

After this error occurs, if I try to add the project back to the server, I will not be able to run the servlet due to "HTTP Status 404", which is fixed only by using clean on the server.

Reproducible: Always

Steps to Reproduce:
Using TomCat 6.0.24

1. Create a dynamic web project with a servlet
2. Add to the server
3. Run the servlet
4. Remove the project from the server and the error will be shown in a dialog
Comment 1 Angel Vera CLA 2010-03-05 13:29:33 EST
I am wondering how recreatable is this? 

The problem sounds like tomcat hasn't released a hold of the file and thus the files can't be deleted. We should try this with an older tomcat to see if we get the same problem.
Comment 2 Steven Hung CLA 2010-03-05 14:14:09 EST
(In reply to comment #1)
> I am wondering how recreatable is this? 
> 
> The problem sounds like tomcat hasn't released a hold of the file and thus the
> files can't be deleted. We should try this with an older tomcat to see if we
> get the same problem.

Verified with Tomcat 5.5.28 that the same problem occurs
Comment 3 Larry Isaacs CLA 2010-03-08 09:16:05 EST
The steps don't mention starting and stopping the server.  Is the server still running when you are trying to remove the project?
Comment 4 Steven Hung CLA 2010-03-08 10:25:31 EST
(In reply to comment #3)
> The steps don't mention starting and stopping the server.  Is the server still
> running when you are trying to remove the project?

Here are the updated steps:

1. Create a dynamic web project with a servlet
2. Start the server
3. Add the project to the server
4. Restart the server
5. Run the servlet on the server, wait for browser to display the servlet
6. Remove the project from the server and the error will be shown in a dialog

The server is running when the project is removed
Comment 5 Larry Isaacs CLA 2010-03-11 14:30:14 EST
Sorry for not getting back quickly.  This jar locking is a "feature" of Windows.  Tomcat provides an "antiJARLocking" attribute on the <Host> element as a workaround.  However, use of this workaround in WTP means that published changes that affect jars will not be seen by Tomcat until you restart Tomcat.  Similarly, the "antiResourceLocking" attribute will cause all published changes to require a restart to be seen by Tomcat.

As a result, adding and removing projects from the WTP Tomcat server while it is running is not supported.  This fact is currently documented in the Tomcat FAQ (http://wiki.eclipse.org/WTP_Tomcat_FAQ#Can_I_add_or_remove_a_project_from_a_server.2C_or_publish_changes_for_a_project_already_on_a_server.2C_while_that_server_is_running.3F).  Since this is fundamentally a Tomcat/Windows issue, resolving as NOT_ECLIPSE.