Debugging vicious java.net.BindException (Windows)
java.net.BindException is thrown when JVM fails binding a socket to a local address and port.. Most common reason is that port is already used by some other application/service. Message like “Port already in use: 1098;” further confirms this.
This is how you can debug this exception:
- Check which service is binding the port by command “netstat –b”
This will list down all port and the application which binds the port like:
Proto Local Address Foreign Address State PID
TCP hddlntd100000:1090 test.test.cim:1026 ESTABLISHED 2248 [OUTLOOK.EXE]
- Now check for the port which is shown as already in use. Like if the message resulted by BindException is “Port already in use: 1098”, then 1098 is in use by other application.
- Identify the application running on the given port. Like Outlook is acquiring port 1090.
- Either close the application which is acquiring the port directly by exiting the application like in case of Outlook or go to task manager and do end task for the given application/service. If application/service closes successfully you are done, now retry whatever had caused BindException earlier.
January 23, 2009 | Filed Under Java
Related Post
Comments
Leave a Reply