1、編碼問題:window->Preferences->General->Wrokspace->Text file encoding->Other 選utf-8
2、原項目使用的tomcat版本與當前tomcat版本不一致
解決方法:window->Preferences->server->Runtime Environments 添加對應版本的tomcat
以tomcat8版本爲例子,導入新的tomcat文件所在地之後可能會出現的問題:下面頁面報錯誤The Apache Tomcat installation at this directory is version 8.5.6 Tomcat 8.0 installation is expect
解決方式:
①在Tomcat的安裝目錄中找到lib目錄,再找到catalina.jar。使用壓縮軟件(WinRAR或是好壓)打開它。
②依次找到並雙擊打開org\apache\catalina\util\ServerInfo.properties 文件
修改前:
server.info=Apache Tomcat/8.5.6
server.number=8.5.6.0
server.built=Oct 6 2016 20:15:31 UTC
修改後:
#Apache Tomcat/8.5.6
server.info=Apache Tomcat/8.0.0
#8.5.6.0
server.number=8.0.0
server.built=Oct 6 2016 20:15:31 UTC
再次添加tomcat時錯誤會消失,右鍵運行項目時會在新的tomcat上運行
3、進入項目文件下的.settings目錄,找到org.eclipse.wst.common.project.facet.core.xml文件,用記事本打開後才發現這句話有問題:<runtime name="Apache Tomcat v8.0"/>。eclipse中設置的tomcat是7.0版本的,而報錯項目的運行環境是8.0版本的tomcat,把這句話刪掉或者改成自己的所用的版本即可。