Can't use port 8080 - what is running on it? (OS X Mavericks)

2

I'm trying to run Tomcat on port 8080 using cargo, but it gives the message:

org.codehaus.cargo.container.ContainerException: Port number 8080 (defined with the property cargo.servlet.port) is in use. Please free it on the system or set it to a different port in the container configuration.

When I telnet to localhost on 8080, it connects.

But, when I sudo lsof -n | grep 8080, I see nothing. No luck with netstat either.

What could be the problem?

Eddified

Posted 2014-09-12T20:32:12.243

Reputation: 1 440

Yes, I know I can use a different port--that's not the question I'm asking. – Eddified – 2014-09-12T20:33:09.447

I already looked at the likes of : http://stackoverflow.com/questions/5310945/deployment-errorstarting-of-tomcat-failed-the-server-port-8080-is-already-in-u -- nothing I've found helps resolve the issue.

– Eddified – 2014-09-12T20:37:13.987

What gives you the idea we would know what software you are running that uses port 8080? If anyone would know or be able to find out, it would be you. Listing any possible software that could be the case is outside of the scope of this site though. – LPChip – 2014-09-12T20:48:09.083

1lsof uses service names (http, ssh, ftp, webcache) by default when available and not port numbers. Add a -P to have it use port numbers, sudo lsof -n -P | grep :8080. – Brian – 2014-09-13T02:45:59.207

@LPChip, let's try solving the problem rather than berating the questioner. – music2myear – 2014-09-16T20:18:14.440

Answers

1

The output of a lot of the networking commands is made to be more human readable by default. They use host names and service names rather than IP addresses and port numbers.

APP.DOMAIN.COM:http (LISTEN) vs 10.191.12.109:80 (LISTEN)

To grep a port number in the output of such commands you have to make sure it uses port numbers. For lsof that is the -P command option.

sudo lsof -n -P | grep :8080

For netsat using -n turns off both host and service names.

sudo netstat -lpn | grep :8080

Brian

Posted 2014-09-12T20:32:12.243

Reputation: 8 439

Still doesn't show anything for port 8080. – Eddified – 2014-09-14T23:16:09.433

0

I also struggled to find what was running on port 8080 as both the commands sudo lsof -i:8080 and netstat do no show anything specific to port 8080. I ran the command sudo lsof -i:80 to find what was using it - it turned out that ESet Antivirus installed on my Mac was blocking. I uninstalled ESet and everything is fine now.

Ravinder Singh

Posted 2014-09-12T20:32:12.243

Reputation: 1

0

The lsof command @Brian suggested should work (although I prefer to have lsof do its own filtering with sudo lsof -i:8080). If you're not seeing anything with any of those commands I suspect something else is going on. For example, is it possible Tomcat is trying to open the port twice and conflicting with itself?

Gordon Davisson

Posted 2014-09-12T20:32:12.243

Reputation: 28 538

No, after a reboot of my machine (ie, Tomcat isn't involved at all -- I'm only using Tomcat inside my IDE), telnet is still able to connect to something on port 8080. – Eddified – 2014-09-15T21:52:31.810

@Eddified Does sudo lsof -i:8080 show anything at all? What about netstat -an | grep LISTEN? – Gordon Davisson – 2014-09-16T00:51:44.727

sudo lsof -i:8080 shows nothing at all. The netstat -an | grep LISTEN command shows some things but nothing showing use of 8080. – Eddified – 2014-09-16T05:27:34.787