部署错误:Tomcat启动失败,服务器端口8080已在使用中

当我使用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)

        ... 16 more

BUILD FAILED (total time: 4 seconds)

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


有什么问题吗?


慕容3067478
浏览 1329回答 3
3回答

冉冉说

goto命令提示符netstat -aon对于Linuxnetstat -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检查哪个进程绑定了您的端口。在上面的示例中,248如果您确定需要杀死该进程火,则为现在Linux:kill -9 248视窗:taskkill /f /pid 248它会杀死那个过程

ITMISS

如果在Linux上,您可以使用此脚本杀死现有的Tomcat。#/bin/bashif [ `whoami` != root ]; then    echo "Please run this script as root or using sudo"    exitfiechoecho "finding proceses that have name java and established connections status"echoecho "Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name"netstat --tcp  --programs  | grep "ESTABLISHED" | grep "java"echoecho "finding proceses that use port 8080 or http-alt"echonetstat --tcp --programs | grep ':8080\|:http-alt'echo -n "Do you wish to kill a process listed above?[Y/n]"read chooseif [ "$choose" = "Y" ] || [ "$choose" = "y" ] || [ -z "$choose" ]thenecho "enter pid to kill"read procesIdkill -9 $procesIdfiecho "done exiting"exit 0
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Java