This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Glassfish and the fly likes Glassfish server cannot start ERROR - no free port within range: Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » Glassfish
Bookmark "Glassfish server cannot start ERROR - no free port within range:" Watch "Glassfish server cannot start ERROR - no free port within range:" New topic
Author

Glassfish server cannot start ERROR - no free port within range:

Ramesh Kumar Swarnkar
Ranch Hand

Joined: Sep 15, 2003
Posts: 84
Hi,
When I installed Glassfish first time I am able to run the port 8080 and can configure JMS resources on it. It asked to restart. Hence I restarted it.
But there after the server started giving following error:

[#|2013-04-05T20:47:32.148+0530|SEVERE|glassfish3.1.2|grizzly|_ThreadID=16;_ThreadName=Thread-2;|doSelect IOException
java.net.BindException: No free port within range: 7676=com.sun.enterprise.v3.services.impl.ServiceInitializerHandler@1cf3710
at com.sun.grizzly.TCPSelectorHandler.initSelector(TCPSelectorHandler.java:432)
at com.sun.grizzly.TCPSelectorHandler.preSelect(TCPSelectorHandler.java:378)
at com.sun.grizzly.SelectorHandlerRunner.doSelect(SelectorHandlerRunner.java:188)
at com.sun.grizzly.SelectorHandlerRunner.run(SelectorHandlerRunner.java:132)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
|#]

I have checked the ports [ "netstat -a > c:\portsStatus.txt" ] and found all the ports 7676 and 8080 , 4848 are free.
It is not listening on either of 8080 and 4848 ports,as I can not open pages localhost:8080 or localhost:4848

I was doubting if it might be host mapping issue. therefore I check the "C:\WINDOWS\system32\drivers\etc\hosts" file and it had entry of
127.0.0.1 localhost
which I comneted and make a new entry.
10.202.60.127 localhost

Still no progress . I get the same error message as I can check into the domain1's log file.

Can some one give some pointer to overcome this issue please ?


Michael Ernest
High Plains Drifter
Sheriff

Joined: Oct 25, 2000
Posts: 7292

This is a common occurrence on systems that get their IP addresses through DHCP. Reconfigure your GlassFish server to listen to the IP address you've been given and the problem will probably clear up.


Make visible what, without you, might perhaps never have been seen.
- Robert Bresson
Ramesh Kumar Swarnkar
Ranch Hand

Joined: Sep 15, 2003
Posts: 84
I run the following command (i.e. 'D:\glassfish3\bin\asadmin.bat )
asadmin set configs.config.server-config.network-config. network-listeners.network-listener.http-listener-1.address=10.202.60.127
But it failed.

Then I tried altering the 'domain.xml' file by adding address attribute:
<network-listener address="10.202.60.127" port="8080" protocol="http-listener-1" transport="tcp" name="http-listener-1" thread-pool="http-thread-pool"/>

- This also failed.

Any pointer to reconfigure the GLassfish so that it can listen the local IP please ?
Ramesh Kumar Swarnkar
Ranch Hand

Joined: Sep 15, 2003
Posts: 84
I have learned that this is because of the new Host I have created in addition to default_host on my JMS application server.
I deleted the new host info from \glassfish3\glassfish\domains\rameshDomain1\config\domain.xml and able to run the server successfully.



 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Glassfish server cannot start ERROR - no free port within range:
 
Similar Threads
Getting error - Chapter 4 of Ejb3 in action using glassfish server 2.1
error due to the following reason(s): Web mapping already exists
localhost:4848
Beginning J2EE. Cannot reach deployed EAR.
Beginning J2EE. Cannot reach deployed EAR.