File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Sockets and Internet Protocols and the fly likes Address already in use Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Sockets and Internet Protocols
Bookmark " Address already in use" Watch " Address already in use" New topic
Author Address already in use

Suresh Khant
Ranch Hand

Joined: Feb 27, 2010
Posts: 118
Hi All,

As i have mentioned in the above post :

in the first deploy of the war file , it works fine but whenever i redeploy the war file

i will get the error : Address already in use

it seems that port will be still opened even so if I undeploy the war file

important points to mention :
1) this problem does not arise under windows
2)this problem appears under linux : after undeploy of the war file i used to check whether the port still in use or not using 2 following commands
a) it will be still listening if i use the command
#netstat -anp | grep 11900
tcp 0 0* LISTEN -

b) the port appears to be unused if i use the command
#lsof -i:11900

any one tell me how to fix the issue

here is the full code :
Suresh Khant
Ranch Hand

Joined: Feb 27, 2010
Posts: 118
Hi All ,
I was trying to post reply to my old post :
but accidently new post created (This is just to inform you that i did not intend to post something duplicates)

Thanking all for understanding , I am stuck in this issue ...........
Nitesh Kant

Joined: Feb 25, 2007
Posts: 1638

There is too much of code here to read.

In order to find out why your server did not shutdown, you would probably have to do a remote debug and find out whether the shutdown call reached the server.
If you feel the threads did not get interrupted, take a jstack of the process and see where the threads are stuck.

I would recommend using a library such as netty if you are trying to write an NIO server, instead of re-inventing the wheel.

apigee, a better way to API!
I agree. Here's the link:
subject: Address already in use
It's not a secret anymore!