在使用tomcat6.0加载项目的时候,报:There are no resources that can be added or removed from the server.即使新建一个项目,把其.settings文件夹拷到当前项目也没有用。因为新建项目默认Dynamic Web Module也是3.0,这时我搜到一个帖子:
注意到Dynamic Web Module的版本号要和tomcat的servlet-api版本号一致。(tomcat6.0的api版本号可以在路径:D:\apache-tomcat-6.0.32-windows-x64\apache-tomcat-6.0.32\lib下的servlet-api.jar中的META-INF/MANIFEST.MF中查看。)
可以看到:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.7.0
Created-By: 1.5.0_15-b04 (Sun Microsystems Inc.)
X-Compile-Source-JDK: 1.5
X-Compile-Target-JDK: 1.5
Ant-Version: Apache Ant 1.7.0
Created-By: 1.5.0_15-b04 (Sun Microsystems Inc.)
X-Compile-Source-JDK: 1.5
X-Compile-Target-JDK: 1.5
Name: javax/servlet/
Specification-Title: Java API for Servlets
Specification-Version: 2.5
Specification-Vendor: Sun Microsystems, Inc.
Implementation-Title: javax.servlet
Implementation-Version: 2.5.MR2
Implementation-Vendor: Apache Software Foundation
Specification-Title: Java API for Servlets
Specification-Version: 2.5
Specification-Vendor: Sun Microsystems, Inc.
Implementation-Title: javax.servlet
Implementation-Version: 2.5.MR2
Implementation-Vendor: Apache Software Foundation
可以看到版本号是2.5,
如果直接在build-path里把3.0改成2.5,会发现改不了,
于是我们把E:\workspace\E_shop\.settings下的org.eclipse.wst.common.project.facet.core.xml改一下,
这时回到facets,发现已经自动变为2.5
再次部署项目的时候,就没有问题了。