Could not start GlassFish 4.0 (Windows) - port 1527 - Address already in use

Juan Jose Polanco Arias picture Juan Jose Polanco Arias · May 7, 2014 · Viewed 24.7k times · Source

I'm a newbie in Java EE 7.

I have Netbeans 7.4 with GlassFish 4.0 and Java EE 7. In a 64-bit Windows 8.1 Pro machine. I want to start the GlassFish 4.0 Server, so I clicked on the services tab in Netbeans and then in the Servers option I right-clicked GlassFish Server 4.0 and then clicked Start.

When I did that I got the following message: "Could not start GlassFish Server 4.0: HTTP or HTTPS listener port is occupied while server is not running". I have also the IIS server, but I stopped it. After stopping IIS I tried to start again the GlassFish but it showed me the same message.

Also there is a window in Netbeans called Output - Java DB Database Process and it showed me the following:

Tue May 06 22:03:11 GMT-05:00 2014 : Security manager installed using the Basic server security policy.
Tue May 06 22:03:11 GMT-05:00 2014 Thread[main,5,main] java.io.FileNotFoundException: D:\Users\Juan Jose\.netbeans-derby\derby.log (Access is denied)
Tue May 06 22:03:12 GMT-05:00 2014 : Could not listen on port 1527 on host localhost:
 java.net.BindException: Address already in use: JVM_Bind
Tue May 06 22:03:12 GMT-05:00 2014 : Could not listen on port 1527 on host localhost:
 java.net.BindException: Address already in use: JVM_Bind

I ran a netstat -a in Windows to see what was happening with the 1527 port and that port is in LISTENING mode.

So how can I know what application or process is ocuppying the 1527 port?

Thanks for your help !!

Answer

Paul Vargas picture Paul Vargas · May 7, 2014

To find the process1 that keeps the busy port, try the following command:

netstat -ano | find "1527"

This will show a line with the port and the identifier of the process. e.g.:

TCP    127.0.0.1:1527         0.0.0.0:0              LISTENING       2268

Once you have the process ID (e.g. 2268), run the following command for release the port (this will kill the process):

taskkill /F /PID 2268

Now, try to start Glassfish.


On Linux:

lsof -Pnl +M -i6 | grep 1527

Produces:

java    31139     1001   32u  IPv6 114916062      0t0  TCP 127.0.0.1:1527 (LISTEN)

Killed with:

kill -9 31139

1 If you want to know the associated program, see How do I find out what service is using a certain port?