当前位置: 代码迷 >> Web前端 >> Tomcat支配时报错Could not copy all resources to.
  详细解决方案

Tomcat支配时报错Could not copy all resources to.

热度:733   发布时间:2012-10-23 12:12:22.0
Tomcat部署时报错Could not copy all resources to...
问题已解决,解决办法:
1. 查看工程下的.mymetadata 看是否少了一个context-root=“” 属性,少的话,加上,值和前边的name属性一样,比如我的:
<?xml version="1.0" encoding="UTF-8"?>
<project-module
type="WEB"
name="OAPMS"
id="myeclipse.1191910938406"
context-root="/OAPMS"
j2ee-spec="1.4"
archive="OAPMS.war">
<attributes>
    <attribute name="webrootdir" value="WebRoot" />
</attributes>
</project-module>

2. 查看.classpath 看 classpathentry 属性是否有工程lib没有的jar文件,删掉部署即可。


今天我在发布项目的时候,突然遇到了:

Deployment failure on Tomcat 6.x. Could not copy all resources to E:\apache-tomcat-6.0.16\webapps\HebbnWebServices. If a file is locked, you can wait until the lock times out to redeploy, or stop the server and redeploy, or manually remove the deployment at E:\apache-tomcat-6.0.16\webapps\HebbnWebServices

再次点部署按钮时就会提示如下:

Undeployment Failure could not be redeployed because it could not be completely removed in the undeployment phase. the most common cuase of this problem is attempting to redeploy while the server is running,which has locked one or more files.

to correct the deployment you will need to stop the server and then redeploy the project before restarting the server.

把我郁闷了半天, 最后总结以下办法, 解决问题。
解决的办法就是在Eclipse中把项目中引用的jar文件重新加一遍就行了,基本原因就是以前的jar文件不存在了,但是项目信息中还有,即项目的.classpath文件中还有不存在的jar文件引用。

可以右键点项目名称,选择Properties,选择Java Build Path,选择Libraries,把所有项目中的jar都remove,然后再点"add jars",把项目中的jar文件都加进来,再次部署就正常了。


文章出处:DIY部落(http://www.diybl.com/course/3_program/java/javajs/20090215/155631.html)

  相关解决方案