gpt4 book ai didi

java - 部署错误 :Starting of Tomcat failed, 服务器端口 8080 已被使用

转载 作者:IT老高 更新时间:2023-10-28 20:52:19 26 4
gpt4 key购买 nike

当我使用 Netbeans 运行我的 Java 项目时,我收到以下错误:

Deployment error:
Starting of Tomcat failed, the server port 8080 is already in use.
See the server log for details.
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:166)
at org.netbeans.modules.j2ee.ant.Deploy.execute(Deploy.java:104)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor619.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:105)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1329)
at org.apache.tools.ant.Project.executeTarget(Project.java:1298)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1181)
at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:277)
at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:460)
at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:151)
Caused by: org.netbeans.modules.j2ee.deployment.impl.ServerException: Starting of Tomcat failed, the server port 8080 is already in use.
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance._start(ServerInstance.java:1297)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.startTarget(ServerInstance.java:1251)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.startTarget(ServerInstance.java:1062)
at org.netbeans.modules.j2ee.deployment.impl.ServerInstance.start(ServerInstance.java:939)
at org.netbeans.modules.j2ee.deployment.impl.TargetServer.startTargets(TargetServer.java:428)
at org.netbeans.modules.j2ee.deployment.devmodules.api.Deployment.deploy(Deployment.java:143)
... 16 more
BUILD FAILED (total time: 4 seconds)

我尝试将服务器端口更改为 8081 并在 tool->server 中关闭端口。它运行良好,但如果我执行任何操作并再次运行项目,它会显示“部署错误:Tomcat 启动失败,服务器端口 8081 已在使用中

会有什么问题?

最佳答案

转到命令提示符

netstat -aon

Linux

netstat -tulpn | grep 'your_port_number'

它会显示类似的东西

 TCP    192.1.200.48:2053      24.43.246.60:443       ESTABLISHED     248
TCP 192.1.200.48:2055 24.43.246.60:443 ESTABLISHED 248
TCP 192.1.200.48:2126 213.146.189.201:12350 ESTABLISHED 1308
TCP 192.1.200.48:3918 192.1.200.2:8073 ESTABLISHED 1504
TCP 192.1.200.48:3975 192.1.200.11:49892 TIME_WAIT 0
TCP 192.1.200.48:3976 192.1.200.11:49892 TIME_WAIT 0
TCP 192.1.200.48:4039 209.85.153.100:80 ESTABLISHED 248
TCP 192.1.200.48:8080 209.85.153.100:80 ESTABLISHED 248

检查哪个进程绑定(bind)了您的端口。在上面的例子中,它的 248 现在如果你确定你需要杀死那个进程火

Linux:

kill -9 248

window :

taskkill /f /pid 248

它会杀死那个进程

关于java - 部署错误 :Starting of Tomcat failed, 服务器端口 8080 已被使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5310945/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com