原因,是另一個 service 已經占用掉 8005,8080 port, eclipse 會另外再叫出一個 tomcat 所以會衝突。解法,先把開機會自動啟用的 tomcat 停掉。例如:
sudo service tomcat stop
You’ve another instance of Tomcat already running. You can confirm this by going to http://localhost:8080
in your webbrowser and check if you get the Tomcat default home page or a Tomcat-specific 404 error page. Both are equally valid evidence that Tomcat runs fine; if it didn’t, then you would have gotten a browser specific HTTP connection timeout error message.
You need to shutdown it. Go to /bin
subfolder of the Tomcat installation folder and execute the shutdown.bat
(Windows) or shutdown.sh
(Unix) script. If in vain, close Eclipse and then open the task manager and kill all java
and/or javaw
processes.
Or if you actually installed it as a Windows service for some reason (this is namely intented for production and is unhelpful when you’re just developing), open the services manager (Start > Run > services.msc) and stop the Tomcat service. If necessary, uninstall the Windows service altogether. For development, just the ZIP file is sufficient.
Or if your actual intent is to run two instances of Tomcat simultaneously, then you have to configure the second instance to listen on different ports. Consult the Tomcat documentation for more detail.
每次開機都要停一次, 很麻煩, 研究看看開機不啟用.
列出所有停用的服務指令:
sudo systemctl list-unit-files --state=disabled
列出所有啟用的服務指令:
sudo systemctl list-unit-files --state=enabled
可以看到 tomcat enabled
To enable tomcat service to start on boot, use the syntax:
sudo systemctl enable tomcat
To disable tomcat service to start on boot, use the syntax:
sudo systemctl disable tomcat
系統回傳訊息:
Removed /etc/systemd/system/multi-user.target.wants/tomcat.service.