java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind 处理方法

今天部署项目过程中tomcat报如下异常:
  1. java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind
  2. at java.net.PlainSocketImpl.socketBind(Native Method)
  3. at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
  4. at java.net.ServerSocket.bind(ServerSocket.java:319)
  5. at java.net.ServerSocket.<init>(ServerSocket.java:185)
  6. at java.net.ServerSocket.<init>(ServerSocket.java:141)
  7. at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:50)
  8. at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:494)
  9. at org.apache.tomcat.util.net.JIoEndpoint.start(JIoEndpoint.java:513)
  10. at org.apache.coyote.http11.Http11Protocol.start(Http11Protocol.java:202)
  11. at org.apache.catalina.connector.Connector.start(Connector.java:1132)
  12. at org.apache.catalina.core.StandardService.start(StandardService.java:457)
  13. at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
  14. at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
  15. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  16. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
  17. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
  18. at java.lang.reflect.Method.invoke(Method.java:597)
  19. at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
  20. at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
  21. 2012-11-27 17:13:51 org.apache.catalina.startup.Catalinastart
java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind

    at java.net.PlainSocketImpl.socketBind(Native Method)

    at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)

    at java.net.ServerSocket.bind(ServerSocket.java:319)

    at java.net.ServerSocket.<init>(ServerSocket.java:185)

    at java.net.ServerSocket.<init>(ServerSocket.java:141)

    at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:50)

    at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:494)

    at org.apache.tomcat.util.net.JIoEndpoint.start(JIoEndpoint.java:513)

    at org.apache.coyote.http11.Http11Protocol.start(Http11Protocol.java:202)

    at org.apache.catalina.connector.Connector.start(Connector.java:1132)

    at org.apache.catalina.core.StandardService.start(StandardService.java:457)

    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)

    at org.apache.catalina.startup.Catalina.start(Catalina.java:552)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

    at java.lang.reflect.Method.invoke(Method.java:597)

    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)

    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)

2012-11-27 17:13:51 org.apache.catalina.startup.Catalinastart

Google下发现原来是端口被占用。对于这个异常其实很容易解决,不外乎两种解决方法:

1、更改tomcat端口

2、 关掉占用该端口的进程。

一、更改tomcat端口

首先到安装目录(或者解压目录)下找到conf文件夹,在里面找到server.xml的文件,找到

  1. <Connector port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
  2. enableLookups="false" redirectPort="8443" acceptCount="100"
  3. debug="0" connectionTimeout="20000"
  4. disableUploadTimeout="true" />
<Connector port="8080" maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
debug="0" connectionTimeout="20000" 
disableUploadTimeout="true" />

将port="8080"改为其它的就可以了

二、关闭占用该端口的进程

1、首先进入命令行查看端口是否被占用

使用命令: netstat –ano。如下:

我的服务器端口是:8080。从上面可以看出8080端口已经被PID5268的进程占用。

2、查看该PID5268的进程

使用命令:tasklist|findstr "5268"。如下

从上面看出PID5268的进程为javaw.exe

第一种解决办法是:把javaw.exe进程关掉

第二种解决办法是:直接通过任务管理器查看PID5268的进程,然后关掉windows任务管理器->查看->选择列选中PID然后查看任务管理器,关掉PID5268的进程。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值