我一直试图在本地主机上运行我的Apache Tomcat服务器来运行我的JSP项目,由于某种原因,它给了我一个JVM_Bind错误,提示端口8080已被使用。

将端口更改为9876后,仍然出现相同的错误:

SEVERE: StandardServer.await: create[localhost:9876]:
java.net.BindException: Address already in use: JVM_Bind
    at java.net.DualStackPlainSocketImpl.bind0(Native Method)
    at java.net.DualStackPlainSocketImpl.socketBind(Unknown Source)
    at java.net.AbstractPlainSocketImpl.bind(Unknown Source)
    at java.net.PlainSocketImpl.bind(Unknown Source)
    at java.net.ServerSocket.bind(Unknown Source)
    at java.net.ServerSocket.<init>(Unknown Source)
    at org.apache.catalina.core.StandardServer.await(StandardServer.java:427)
    at org.apache.catalina.startup.Catalina.await(Catalina.java:777)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:723)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:321)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)


因此,我使用netstat -an | findstr "9876"命令在cmd中检查是否有占用端口9876的端口,但没有发现任何错误。是什么可能导致此问题?

最佳答案

有两种方法可以处理此错误:


检查端口是否正在侦听的命令:C:\>netstat -ano | find "9876"TCP 0.0.0.0:9876 0.0.0.0:0 LISTENING 26732
更改Tomcat端口号:
转到apache--conf然后打开Server.xml文件

 <Connector port="9876" protocol="HTTP/1.1"
       connectionTimeout="20000"
       redirectPort="8443" />


然后将端口号更改为8089或任何数字。乐于帮助

10-08 16:41