Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I develop on Mac (Lion) with Eclipse and GlassFish 3.1. GlassFish uses ports 8080 and 4848. Suddenly, when I try to launch GlassFish it tells me it can't because there's a port conflict.

As far as I can tell, nothing is using that port. I shut down everything and restarted the Mac and still get the same error when I ran GlassFish. I uninstalled GlassFish, deleted all the directories, restarted my machine, reinstalled GlassFish and same problem.

I created a new test user on my Mac, log out as me, log in as him, install GlassFish under that users account and it runs fine there.

It's like there's something in my user account that makes my Mac or GlassFish think that port is in use.

Does anyone know how I might solve this problem? I hate the idea of having to create a new account on my Mac and transfer all of my data there. Seems like an excessive solution.

share|improve this question
    
If nmap gives nothing try telneting to the port –  Mark Sep 1 '11 at 20:58
add comment

3 Answers 3

up vote 1 down vote accepted

NMAP will provide a listing of open ports and programs that are currently using them. It is actually a powerful networking tool that can perform a wide variety of network maintenance tasks.

You can read more about it here: http://nmap.org/book/inst-macosx.html

It is a small commandline utility (although GUI front-ends are available) that is quite easy to use and should give you a detailed view of your current network state.

share|improve this answer
    
Hi cksum. thanks for the help. I've done some lsof and less /etc/services and as far as I can tell there is nothing running that's using that port. I have no idea why GlassFish remotes a port conflict. –  Robert Hume Sep 1 '11 at 20:52
2  
I suggest you run nmap. It won't look for services that are currently running, but will investigate the ports themselves and provide information on what is using them. lsof isn't really the best utility for this job. Alternatively, you could fire up Network Utility (in the Utilities folder) and run Nestat. That should give you a better view of your network state. –  cksum Sep 1 '11 at 21:48
add comment

You can use lsof -i TCP:8080. The only problem, I think, is that it will find out that Java is using that port; if you kill that java process, you still won't be able to start Glassfish.

My solution is to delete all the domains in the glassfish directory, and then delete the Glassfish server, and installing a new one with a new domain.

For me it's a domain issue.

share|improve this answer
    
"The only problem I think is that it will find out that java is using that port. And if you kill that java process, you still won't be able to start glassfish." ... why would that be the case? –  Peter Štibraný Sep 4 '11 at 18:17
add comment

netstat -nap would also work. If the process isn't your own you'll need to use sudo. It'll list out all the open ports, with their status, and the PID of the owning process.

Something like:

sudo netstat -nap | grep 8080
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.