Community
Participate
Working Groups
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
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.
(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
The steps don't mention starting and stopping the server. Is the server still running when you are trying to remove the project?
(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
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.