問題:java
No.1: java.lang.IllegalArgumentException: Document base C:\Users\hanrong\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Struts2_test1 does not exist or is not a readable directory
web
嚴重: Exception starting Context with name [/Struts2_test1]
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Struts2_test1]]apache
No.2: java.lang.IllegalArgumentException: Document base C:\Users\hanrong\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\Struts2_test2 does not exist or is not a readable directory
服務器
嚴重: Exception starting Context with name [/Struts2_test2]
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/Struts2_test2]]app
問題緣由:eclipse
在學習使用 Eclipse 開發 Java Web 應用程序時,經常會拷貝舊項目而後改個名字做爲新的項目。這樣直接運行新的項目則會發生以上的錯誤。由於舊項目和新項目的 Context root 是同樣的,當它們同時被 Tomcat 服務器加載時,因爲兩個項目處於同一個虛擬主機(Host)當中,就會發生衝突了。webapp
解決方法:學習
修改其中一個項目工程的 Context root(以下圖所示)。spa