eclipse JavaWeb ApplicationContextjava
1.在服務器上運行TestHelloServlet.java時報錯。該文件主要是經過Web服務器實例化ApplicationContext容器。服務器
2.案例代碼來自書籍《JavaEE框架整合開發入門到實戰——Spring+SpringMVC+MyBatis》P14(2.2.2 ApplicationContext)框架
1.Resource '/Servers' does not exist.eclipse
2.'Starting Tomcat v9.0 Server at localhost' has encountered a problem.
Port 8080 required byTomcat v9.0 Server at localhost is already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the portnumber(s).編輯器
1.刪除原有Server,新建Server
2.修改端口
3.重啓eclipse學習
1.在服務器上運行TestHelloServle As--Run on Server)ui
2.報錯:this
Resource '/Servers' does not exist.
3.刪除Server
1)刪除底部Server面板的全部服務器;
2)刪除左邊Server文件夾
若是項目較爲重要,建議備份一下Server文件夾。個人項目只是一些案例的學習,不過重要,因此直接刪除
4.新建Server(在對應項目上右擊,好比Ch1項目,而後依次選擇New--Other)
spa
5.啓動底部Server面板的服務器
6.報錯.net
'Starting Tomcat v9.0 Server at localhost' has encountered a problem.
Port 8080 required byTomcat v9.0 Server at localhost is already in use. The server may already be running in another process, or a system process may be using the port. To start this server you will need to stop the other process or change the portnumber(s).
能夠看出緣由是端口號8080被佔用。解決方法有兩個:①終止其餘使用了端口8080的進程;②修改Tomcat的端口。
經分析,發現是電腦上的Apache Httpd使用了端口號8080(安裝目的主要是爲PHP所用,在Appserv下)。我決定直接修改Tomcat端口
7.打開左側Servers文件夾所在目錄,用文本編輯器打開其下的server.xml文件,搜索相關文本,以修改端口。其中搜索內容爲:
<Connector connectionTimeout=
8.(務必)重啓eclipse
9.啓動Servers面板的服務器
10.在服務器上運行TestHelloServlet.java。(Run As--Run on Server)
11.完成。