Java Tomcat 服务器错误 - 端口 8080 已在使用中
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/34253779/
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
Tomcat Server Error - Port 8080 already in use
提问by Gayathri Ravi
I received the following error while attempting to execute a Servlet program in Eclipse Mars EE.
尝试在 Eclipse Mars EE 中执行 Servlet 程序时收到以下错误。
'Starting Tomcat v8.0 Sever at localhost' has encountered a problem.
Port 8080 required by Tomcat v8.0 Server at localhost is already in use. There 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 port number(s).
'Starting Tomcat v8.0 Sever at localhost'遇到问题。
本地主机上的 Tomcat v8.0 服务器所需的端口 8080 已在使用中。可能已经有另一个进程在运行,或者某个系统进程可能正在使用该端口。要启动此服务器,您需要停止其他进程或更改端口号。
What should I do to stop the process? I'm assuming that Tomcat 7 server must be stopped. How shall I do it if my operating system is Windows 8?
我应该怎么做才能停止这个过程?我假设必须停止 Tomcat 7 服务器。如果我的操作系统是Windows 8,我该怎么做?
Error Screenshot:
错误截图:
采纳答案by Gayathri Ravi
All I had to do was to change the port numbers
.
Open
Eclipse
Go to
Servers panel
Right click on Tomcat Server select
Open
,Overview window
will appear.Open the
Ports
tab. You will get the following:Tomcat adminport
HTTP/1.1
AJP/1.3
I changed the port number of
HTTP/1.1
(i.e. to8081
)You might have to also change the port of
Tomcat adminport
(i.e. to8006
) and ofAJP/1.3
(i.e. to8010
).Access your app in the browser at
http://localhost:8081/...
打开
Eclipse
去
Servers panel
右键单击Tomcat Server select
Open
,Overview window
会出现。打开
Ports
选项卡。您将获得以下信息:Tomcat adminport
HTTP/1.1
AJP/1.3
我改变了
HTTP/1.1
(即到8081
)的端口号您可能还需要更改
Tomcat adminport
(ie to8006
) 和 ofAJP/1.3
(ie to8010
)的端口。在浏览器中访问您的应用程序
http://localhost:8081/...
回答by a-1
Open CMD or Powershell in Administrator mode, then run...
在管理员模式下打开 CMD 或 Powershell,然后运行...
netstat -ab
The output should be able to point you in the direction of which process is holding port 8080. Entry may likely be 127.0.0.1:8080
You may still have a running instance of Tomcat at port 8080
.
输出应该能够指出哪个进程持有端口 8080。条目可能是127.0.0.1:8080
You may still have an running instance of Tomcat at port 8080
。
You can either use Stop-Process
in PowerShellor taskKill
in CMDto stop that process and should be able to execute the program at that point.
您可以使用Stop-Process
在PowerShell中或taskKill
在CMD停止这一进程,应该能够在这一点上执行程序。
回答by Gus
you can stop using the shutdown.bat inside tomcat installation directory. Or you may click "stop" button at the servers view of eclipse. To get to the view select Window - Show View - Servers
你可以停止使用tomcat安装目录中的shutdown.bat。或者你可以在eclipse的servers视图点击“stop”按钮。要进入视图,请选择 Window - Show View - Servers
回答by Arun Gunalan
回答by tak
For Ubuntu users with the same problem (e.g. Eclipse crash during debug) do a netstat -a -p | grep 8095 (or any other port number if the Tomcat server), then kill -9 that process.
对于有相同问题(例如 Eclipse 在调试期间崩溃)的 Ubuntu 用户,请执行 netstat -a -p | grep 8095(或任何其他端口号,如果 Tomcat 服务器),然后 kill -9 该进程。
回答by shrijit
You've another instance of Tomcat already running. You can confirm this by going to http://localhost:8080in 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.
您已经运行了另一个 Tomcat 实例。您可以通过在 Web 浏览器中访问http://localhost:8080来确认这一点,并检查您是否获得了 Tomcat 默认主页或特定于 Tomcat 的 404 错误页面。两者都是 Tomcat 运行良好的同样有效的证据;如果没有,那么您将收到特定于浏览器的 HTTP 连接超时错误消息。
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.
你需要关闭它。转至Tomcat 安装文件夹的/bin 子文件夹并执行shutdown.bat (Windows) 或shutdown.sh (Unix) 脚本。
for more help please chech this answer.
如需更多帮助,请查看此答案。
回答by Naved Ali
To get rid of this error just click on server tab on eclipse . You will get list of servers as below image (In my case it was tomcat 8 only)
要消除此错误,只需单击 eclipse 上的服务器选项卡。您将获得如下图所示的服务器列表(在我的情况下,它仅是 tomcat 8)
Double click on the respective server. You will get screen as shown below :-
双击相应的服务器。您将获得如下所示的屏幕:-
Now change Conflicting port number. In my case I changed 8080 to 8081 (highlighted portion). Save it (ctrl+s) and hence you can start your server now.
现在更改冲突端口号。就我而言,我将 8080 更改为 8081(突出显示的部分)。保存它 (ctrl+s),因此您现在可以启动您的服务器。
回答by bosari
I would suggest to end java.exe
or javaw.exe
process from task manager and try again. This will not end the entire eclipse application but will free the port.
我建议从任务管理器结束java.exe
或javaw.exe
处理,然后再试一次。这不会结束整个 eclipse 应用程序,但会释放端口。
回答by Sanket Patel
netstat -ano | findstr 8080
taskkill /pid 21424 /F
execute the above command in command prompt first command will find the pid of the processes which are using port 8080 or any other port you are using. And in second command write the pid of instead of 21424.
在命令提示符下执行上述命令,第一个命令将找到使用端口 8080 或您正在使用的任何其他端口的进程的 pid。并在第二个命令中写入 pid 而不是 21424。
回答by Siddhartha
Open below application
打开下面的应用程序
C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Apache Tomcat 8.5 Tomcat8
C:\Users\%username%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Apache Tomcat 8.5 Tomcat8
right click on Apache tomcat in system tray and click on stop services
右键单击系统托盘中的 Apache tomcat,然后单击停止服务
Run your application from eclipse.
从 Eclipse 运行您的应用程序。
http://siddartech.com/apache/apachi-tomcat-server-already-in-use/
http://siddartech.com/apache/apachi-tomcat-server-already-in-use/