eclipse sts 无法启动 tomcat:端口已在使用中
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9096490/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
eclipse sts cannot start tomcat: ports already in use
提问by Vyacheslav
Tested eclipse indigo, STS 2.5.2, STS 2.8.0, STS 2.8.5. Tomcat 6, Tomcat 7.
已测试 eclipse indigo、STS 2.5.2、STS 2.8.0、STS 2.8.5。雄猫6,雄猫7。
Tomcat startup hangs at 23%(displayed at right bottom side of eclipse windows/screen). This magic number is always the same. After about 20 seconds at hanged state error occurs. Error info is "ports are already in use".
Tomcat 启动在 23% 时挂起(显示在 Eclipse 窗口/屏幕的右下方)。这个神奇的数字总是一样的。大约 20 秒后,出现挂起状态错误。错误信息是“端口已被使用”。
There is no Tomcat already started in system. No ports with specified numbers appear in netstat.
系统中没有已经启动的Tomcat。netstat 中没有出现指定编号的端口。
Changing port numbers does not help anything.
更改端口号没有任何帮助。
Changing/reinstalling eclipse,STS,tomcat, downloading fresh tomcat zip changes nothing. Deleting workspace and C:/Project/.metadata and stuff - all directories used by fresh install of STS, so deleting them does not help too.
更改/重新安装 eclipse、STS、tomcat、下载新的 tomcat zip 没有任何改变。删除工作区和 C:/Project/.metadata 和东西 - 全新安装的 STS 使用的所有目录,因此删除它们也无济于事。
And interesting history aspect: i've used STS 2.8.2 for 2 weeks before this error occured. Reinstall won't fix anything. After that i was able to use STS 2.5.2 for a month. And the same error occured for 2.8.2. But i delete all its files and reinstall again does not fix anything.
有趣的历史方面:在发生此错误之前,我已经使用 STS 2.8.2 2 周了。重新安装不会解决任何问题。之后我就可以使用 STS 2.5.2 一个月了。2.8.2 也出现了同样的错误。但是我删除了它的所有文件并重新安装并没有解决任何问题。
Reboot does not help.
重新启动没有帮助。
Have no any other working with tomcat version of eclipse/STS.
没有任何其他使用 Eclipse/STS 的 tomcat 版本的工作。
Any help is appreciated.
任何帮助表示赞赏。
Also please add tag for http://www.springsource.com/developer/sts
另外请为http://www.springsource.com/developer/sts添加标签
my os is windows 7. In Virtualbox XP everything is fine. And other Windows 7 guys say it works too on their PCs.
我的操作系统是 Windows 7。在 Virtualbox XP 中一切正常。其他使用 Windows 7 的人说它也可以在他们的 PC 上运行。
回答by ILMaliek
I have the same problem as yours.
我和你有同样的问题。
To solve this problem, open Internal Web Browser inside eclipse / STS, then open
要解决这个问题,在eclipse/STS里面打开Internal Web Browser,然后打开
http//localhost:8080/yourproject/
http//本地主机:8080/你的项目/
then try to running tomcat again. Now tomcat should be running.
然后再次尝试运行tomcat。现在 tomcat 应该正在运行。
Looks like very funny eh, but it works on me. This might be bugs on eclipse / STS. I found this problem only on windows, and so far never happen on my linux.
看起来很有趣诶,但它对我有用。这可能是 eclipse / STS 上的错误。我只在 windows 上发现了这个问题,到目前为止,我的 linux 上从未发生过。
回答by qarataw
Kill "java.exe" process from TaskManager in Windows
从 Windows 中的 TaskManager 杀死“java.exe”进程
回答by shameer salim
The above solutions didnt work for me. Open command prompt -> navigate to tomcat bin folder -> kill tomcat instance (shutdown.bat)
上述解决方案对我不起作用。打开命令提示符 -> 导航到 tomcat bin 文件夹 -> 杀死 tomcat 实例(shutdown.bat)
And then start the tomcat from eclipse. It worked just fine for me
然后从eclipse启动tomcat。它对我来说很好用
回答by Neeraj
if you are on linux
如果你在 linux 上
netstat -nab | grep :8080
netstat -nab | 格雷普:8080
we have simlar command on windows i guess you use find instead of grep.
我们在 Windows 上有类似的命令,我猜您使用的是 find 而不是 grep。
this will help you find the process id blocking port 8080
这将帮助您找到阻塞端口 8080 的进程 ID
Also try telnet 8080 to get an idea
也可以尝试 telnet 8080 来了解一下
sometimes windows firewall also blocks ports - make sure firewall has an exception for this port.
有时 Windows 防火墙也会阻止端口 - 确保防火墙对此端口有例外。
回答by fargraph
This isn't a great answer, but it got me up and running on my local machine. I had the same results, except for the port error you indicated. Mine would just say "Server failed to start in 45 seconds" with no other explanation. I could adjust the server start time, but that would only delay the inevitable. I had been using tomcat in /opt/dev. I downloaded Tomcat 7.0.26 and installed it into my home directory. I started STS and removed all of my tomcat 7 runtimes. Then I added a new server runtime:
这不是一个很好的答案,但它让我在本地机器上启动并运行。除了您指出的端口错误之外,我得到了相同的结果。我的只会说“服务器无法在 45 秒内启动”,没有其他解释。我可以调整服务器启动时间,但这只会延迟不可避免的事情。我一直在 /opt/dev 中使用 tomcat。我下载了 Tomcat 7.0.26 并将其安装到我的主目录中。我启动了 STS 并删除了我所有的 tomcat 7 运行时。然后我添加了一个新的服务器运行时:
- Window->Preferences->Servers->"Runtime Environments"
- Click "Add..."
- Chose "Apache Tomcat v7.0" and check "Create a new local server"
- Point the Installation directory to the server folder in your home directory.
- Click finish.
- 窗口->首选项->服务器->“运行时环境”
- 点击“添加...”
- 选择“Apache Tomcat v7.0”并勾选“创建新的本地服务器”
- 将安装目录指向主目录中的服务器文件夹。
- 单击完成。
I then did a sample server start from within eclipse with no projects added and it started up fine. I don't know what happened, but this seems to have fixed the problem. I then added my projects and things started up just fine.
然后我从 eclipse 中启动了一个示例服务器,没有添加任何项目,它启动得很好。我不知道发生了什么,但这似乎解决了问题。然后我添加了我的项目,事情开始得很好。
回答by CyberSpy_zero
I had the same problem on Linux.
我在 Linux 上遇到了同样的问题。
- Close Eclipse.
- Open terminal and type 'top', then find a process called 'java' and the respective PID.
- Type 'kill [PID]' and restart Eclipse
- 关闭日食。
- 打开终端并输入“top”,然后找到一个名为“java”的进程和相应的 PID。
- 键入“kill [PID]”并重新启动 Eclipse
回答by Mohit Jaiswal
Goto task manager---->details----->search for javaw.exe and select it(you can search bt typing 'j' in details)---->finally tap on end button. ----restart tomcat,it will work. or
转到任务管理器----> 详细信息-----> 搜索 javaw.exe 并选择它(您可以搜索 bt 详细输入 'j')----> 最后点击结束按钮。----重启tomcat,就可以了。或者
kill the javaw.exe from Taskmanager
从任务管理器中杀死 javaw.exe
回答by Gaurav pratap singh
1> open task manager and end the process javaw.exe if it not work then 2>create a new file application.properties under resources and this -server.port = 8081
1> 打开任务管理器并结束进程 javaw.exe 如果它不起作用然后 2> 在资源下创建一个新文件 application.properties 和 -server.port = 8081
回答by Saurabh J
1)Kill javaw.exeprocess from TaskManager in Windows
1)javaw.exe在Windows中从TaskManager杀死进程
2)restart eclipse
2)重启日食

