I am trying to run an web app. In the beginning it was going well, but I had to delete some jars from the project folder. I didn't delete the jars using eclipse. So, I started to get these errors:

Publishing failed with multiple errors
Could not delete C:/Users/maniceto/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/fj21-tarefas/WEB-INF/lib. May be locked by another process.
Could not delete C:/Users/maniceto/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/fj21-tarefas/WEB-INF. May be locked by another process.

I tried to delete my whole project and code it again. But it doesn't work. I also deleted the Tomcat server but again it doesn't work. Then I realized that to "fix" this problem I have to delete this folder:

C:/Users/maniceto/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/fj21-tarefas/WEB-INF.

And clean the server and the project. But when I close eclipse and open again I get the same error, then I have to do this process.

Anyone here knows how to fix this kind of tomcat bug?

15

There are 15 best solutions below

0
On

Some of your jars are still loaded into memory, therefor their parent directories cannot be deleted. Check if there are running processes accessing any jars or restart Eclipse.

1
On

i don know the exact reason for this problem but i was clear the same issue by restarting my system. so restart your system once, it may gives solution for your problem.

2
On

It may be because you are using C driver and you may need Administration rights to perform operation on this directory, try after change the C drive, in any other drive like D: or E:

0
On

For my issue I just had a process that was hung.

On Windows, open the Task Manager and shut down your hung Java process. On linux run: ps -ef | grep tomcat, then kill the hung process.

1
On

Simply delete the server and then add it again,then restart your eclipse.It worked for me.

0
On

Faced this issue after adding a new dependency to pom,

SOLUTION:

Add maven dependencies to 'deployment assembly'. To do that
right click on the project > Build Path > Configure Build Path > Deployment Assembly > Add > Java Build Path Entries > Maven Dependencies
0
On

I had this issue too.

I tried to clean the server, delete server and reinstall it, delete the tmp0 folder. I tried even to copy and paste same project and change other settings. Nothing really worked for me.

The only thing that worked for me, was to create a new project and copy all the files from the broken project to the new one. My solution also fixed this issue too.

0
On

When you have multiple projects in the workspace, the run button will record the run history, so you should press the triangle button to select the correct run option. For example, when I choose to run "AjaxAdms" directly, an error will be reported, but if I choose to "run tomcat on the localhost" option, no error will be reported.enter image description here Also, as shown in Figure 2 and 3, you should remove unnecessary projects from the Tomcat server.enter image description hereenter image description here

0
On

Close the eclipse and go to below location(depends on your system locaiton)

C:/Users/maniceto/Documents/workspace/.metadata/.plugins/org.eclipse.wst.server.core/

and delete tmp0 directory now start eclipse and it will work fine.

0
On

In my case this happens only when I trigger Update Maven Project (ALT+F5) in Eclipse and the server instance is running with my app attached.

So You have to remove the app from the server ,turn of the server and the n do the Update Maven Project . If the problem persists Clean helps

1
On

there is already a post which answer this question you need to:

  1. Clean Server
  2. Clean Tomcat Work Directory

link to the page: Why is my publishing failing in Tomcat v7.0 Server because of locks by another process?

0
On

Eclipse Juno running Tomcat 7 on Win7; kept getting the publish error on a javascript file. Tried renaming the file but that did not work.

I deleted my existing Tomcat server, as recommended by Vikash Mudliar, and added a new server instance. That worked and I was able to publish successfully.

0
On

If you close a project and it still in Apache Tomcat resources this issue occurs.

0
On

Delete the Tomcat server and reconfigure it, It works fine

0
On

Go to the servers tab-> click on the dropdown menu.It contains all the projects related to that server Now simply right click on the project name you don't want to run right now and select remove