[java] Address already in use: JVM_Bind java

Some times whenever I restart the application, which is built on Java Struts Mysql and Jboss 4.05 Version I get the error as Address already in use: JVM_Bind

Only fix that i know is to restart the machine and try again, it will work. Else Some times I do Ctrl-Alt-Del and Stop all the process related to Java, some times this also works.

But what is the exact reason and how can we prevent this problem ?

This question is related to java web-applications jboss struts

The answer is


please try following options for JVM binding exception:

  1. start and stop the server. and check the server process ids and kill and stop the server.
  2. go to control panel->administrative tool-> service-> check all server and stop all the servers and then start your own server.
  3. change the Browser which your using. for example if your using IE ,change it to Mozilla firefox.

This recently happen to me when enabling JMX on two running tomcat service within Eclipse. I mistakenly put the same port for each server.

Simply give each jmx remote a different port

Server 1

-Dcom.sun.management.jmxremote.port=9000

Server 2

-Dcom.sun.management.jmxremote.port=9001

It can be also caused by double definition of port 8080 in ..\tomcat\conf\server.xml :

<Connector port="8080"
           enableLookups="false" redirectPort="8443" debug="0"/>
<Connector port="8080"
           enableLookups="false" address="127.0.0.1" maxParameterCount="30000"/>

I usually come across this when the port which the server (I use JBoss) is already in use

Usual suspects

  1. Apache Http Server => turn down the service if working in windows.
  2. IIS => stop the ISS using
  3. Skype =>yea I got skype attaching itself to port 80

To change the port to which JBoss 4.2.x binds itself go to:

"C:\jboss4.2.2\server\default\deploy\jboss-web.deployer\server.xml"

here default is the instance of the server change the port here :

<Connector port="8080" address="${jboss.bind.address}" >

In the above example the port is bound to 8080


That error means that the you are trying to create a new ServerSocket on a port already in use by another ServerSocket. So try to make your application closing all sockets and connections you know about and be sure your application is completely terminated. Also check if there is another proces you launched by your program.


I had the same on Windows. My solution was to get which port the debug wants to connect to. (In IntelliJ a red rectangle already giving the info: "Error running Tomcat: Unable to open debugger port (127.0.0.1:XXXXX): ... Already in use...") Let's say XXXXX is the port number. Then i searched for the problem and the PID in a cmd window:

netstat -ano | find "CLOSE_WAIT" | find ":XXXXX"

I got the PID number as the last number in the result line. (Let's say YYYY) Finally:

TASKKILL /PID YYYY

An extra info: Winscp logged out meanwhile, probably it was causing my problem. :)


In windows this scenario happens when Eclipse crashes without a clean shutdown it will have the local Jetty or Tomcat server keep running. When you reopen Eclipse and try to start server again this will lead to the "Address already in use: JVM_Bind"

You can solve this by opening Task Manager and find the javaw.exe process and ending it.

Then you can restart the server on Eclipse.

enter image description here


Open command line and type: netstat -a -o -n or tasklist to see currently running processes. Find port that related to Java and type: taskkill /F /PID <your PID number>. Click Enter.


You can try deleting the Team Server credentials, most likely those will include some kind of port in the server column. Like https://wathever.visualstudio.com:443

Go to Windows/Preferences expand Team then Team Foundation Server go to Credentials and remove whichever is there.


I was having this problem too. For me, I couldn't start/stop openfire (it said it was stopped, but everything was still running)

sudo /etc/init.d/openfire stop
sudo /etc/init.d/openfire start

Also, restarting apache did not help either

sudo /etc/init.d/apache2 restart

The errors were inside:

/opt/openfire/logs/stderror.log
Error creating server listener on port 5269: Address already in use
Error creating server listener on port 5222: Address already in use

The way I fixed this, I had to actually turn off the server inside the admin area for my host.


Is it possible that MySql listening on the same port as JBoss?

Is there a port number given in the error message - something like Address already in use: JVM_Bind:8080

You can change the port in JBoss server.xml to test this.


The quick answer on how to prevent it is that you most likely need to stop JBoss before starting it again.

You should be able to call the "Terminate" button in the Console view to shutdown the server.


Examples related to java

Under what circumstances can I call findViewById with an Options Menu / Action Bar item? How much should a function trust another function How to implement a simple scenario the OO way Two constructors How do I get some variable from another class in Java? this in equals method How to split a string in two and store it in a field How to do perspective fixing? String index out of range: 4 My eclipse won't open, i download the bundle pack it keeps saying error log

Examples related to web-applications

Spring - No EntityManager with actual transaction available for current thread - cannot reliably process 'persist' call How do I choose the URL for my Spring Boot webapp? Difference between MEAN.js and MEAN.io External VS2013 build error "error MSB4019: The imported project <path> was not found" How to unpackage and repackage a WAR file IntelliJ, can't start simple web application: Unable to ping server at localhost:1099 Using form input to access camera and immediately upload photos using web app Pass user defined environment variable to tomcat ASP.NET: HTTP Error 500.19 – Internal Server Error 0x8007000d Best practices when running Node.js with port 80 (Ubuntu / Linode)

Examples related to jboss

How to enable TLS 1.2 in Java 7 Jboss server error : Failed to start service jboss.deployment.unit."jbpm-console.war" SQLException: No suitable Driver Found for jdbc:oracle:thin:@//localhost:1521/orcl PSQLException: current transaction is aborted, commands ignored until end of transaction block JBoss AS 7: How to clean up tmp? How to deploy a war file in JBoss AS 7? How to increase heap size for jBoss server JBoss default password HTTP response header content disposition for attachments PersistenceContext EntityManager injection NullPointerException

Examples related to struts

Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Difference between Spring MVC and Struts MVC Address already in use: JVM_Bind java