Java.net. SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind

Source: Internet
Author: User

Tomcat reports the following exception during project deployment today:

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 found that the port was occupied. This exception is actually easy to solve. There are two solutions:

1. Change tomcat Port

2. Disable the process that occupies the port.

1. Change tomcat Port

First, find the conf folder under the installation directory (or decompress the Directory), find the server. xml file in it, and find

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" />

 

Change port = "8080" to another one.

 

2. Disable the process that occupies the port

1. First, go to the command line to check whether the port is occupied.

Run netstat-ano. As follows:

The port number of my server is 8080. It can be seen from the above that port 8080 has been occupied by processes with a PID of 5268.

2. view the process whose PID is 5268.

Run the following command: tasklist | findstr "5268 ". As follows:

From the preceding figure, we can see that the pid_5268_process is javaw.exe.

The first solution is to disable the javaw.exe process.

The second solution is to directly view the process whose PID is 5268 through the task manager, then turn off the windows Task Manager-> View-> select the PID column and view the task manager, turn off the process with a PID of 5268.

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.