Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

java.lang.Exception: Port 8083 already in use

I am getting exception on console which is:

java.lang.Exception: Port 8083 already in use.

How to resolve this exception? If I will get which service is using 8083 port then I can stop that service and in this way I can get over this problem.

Thanks for your help!

like image 221
S Singh Avatar asked Dec 07 '11 13:12

S Singh


4 Answers

java.lang.Exception: Port 8083 already in use.

The error means that another application already has that port bound so that you can't use it. Typically it means that a server is running (or is exiting) but still has the specific port open. Often this error is given when you are trying to shutdown one server and bring up the new version but the first server isn't total down when the new one is started. You need to find the server in question and you may have to kill it using kill -9 or something.

A good tool to find out which application has the port open is lsof. This should work under most Unixes (Linux) and MacOSX at least.

lsof -i :8083

lsof is for LiSting the Open Files on a system but the -i option is for internet addresses:

-i [i]   This option selects the listing of files any of whose Internet
         address matches the address specified in i.
        [46][protocol][@hostname|hostaddr][:service|port]
like image 74
Gray Avatar answered Nov 10 '22 03:11

Gray


The exception is thrown because you are trying to bind to a port that is already in use by another process.

Using netstat -a from the command line will show you a list of open ports and the process that's using them. Than you can kill it.

Update:

On Windows you can use netstat -ao to list all the in use ports along with the Process ID that owns the connection.

On Linux you can use netstat -p to list the process id/program name.

like image 36
Casey Avatar answered Nov 10 '22 03:11

Casey


I get this with JBoss server every once in a while. It's not intuitive that you would need to restart Java, but the above methods didn't work.

For Mac OS X:

SLOW

  1. Open Activity Monitor.
  2. Filter by "java"
  3. Quit any processes (usually just one).
  4. Restart your server.

FAST

ps aux | grep 'java' to list the current Java processes and their IDs.

kill -9 process_id_goes_here

like image 6
Benxamin Avatar answered Nov 10 '22 01:11

Benxamin


The exception means: there is already a open Port '8083'. You solve it by either stopping that service or by using a different port yourself.

I would guess that your own service is already running when you try to start it, so stop the old instance before starting the new one.

(I know Tomcat runs on 8080 and sometimes people change that to 8083, but its impossible for anyone to know what service runs on your machine using that port.)

like image 1
Angelo Fuchs Avatar answered Nov 10 '22 01:11

Angelo Fuchs