Another Annoying Java Exception
Last week at work I was assigned a task on one of our products which is written in Java 5. I needed to download and run an enormous bunch of source code. To make sure it would work with the least amount of pain, I copied the directory structure of the project, the IDE (in this case Eclipse - you'll probably see future posts of my struggles to get this codebase working in Netbeans!), and Apache Tomcat.
I fired her up, expecting it just to run, but NO! I get this little treat:
Okay, seems like a port conflict. I made sure I shut down my WAMP servers, did a plain old netstat and saw nothing blocking port 80.
Still getting the same exception... Hmmm...
Eventually I found out about some additional switches you can add to netstat that will show more infos.
netstat -a will show you all TCP/UDP connections. netstat -a -o -n will tell you the whole truth. The -a shows only active connections. The -n switch just shows the IP/port instead of trying to get the hostname (so it runs faster etc). The -o switch is the real useful one as it shows the process ID (PID) of the listening process. If you have the PID, you can find the listening program, and close it's ass!
Thanks to this, I could see a service listening to port 80. I got it's pid, and looked it up in the task manager. Turns out it was uTorrent running in the background on port 80.
The interesting thing about this, is that it never seemed to affect my WAMP apache, as it starts and runs fine with uTorrent in the background.
Anyway, point is, if you get this exception, I bet dollars to donuts there's a process running somewhere on your machine that is hogging your configured port.
Good luck!
I fired her up, expecting it just to run, but NO! I get this little treat:
Java(TM) 2 Platform Standard Edition 5.0
Okay, seems like a port conflict. I made sure I shut down my WAMP servers, did a plain old netstat and saw nothing blocking port 80.
Still getting the same exception... Hmmm...
Eventually I found out about some additional switches you can add to netstat that will show more infos.
netstat -a will show you all TCP/UDP connections. netstat -a -o -n will tell you the whole truth. The -a shows only active connections. The -n switch just shows the IP/port instead of trying to get the hostname (so it runs faster etc). The -o switch is the real useful one as it shows the process ID (PID) of the listening process. If you have the PID, you can find the listening program, and close it's ass!
Thanks to this, I could see a service listening to port 80. I got it's pid, and looked it up in the task manager. Turns out it was uTorrent running in the background on port 80.
The interesting thing about this, is that it never seemed to affect my WAMP apache, as it starts and runs fine with uTorrent in the background.
Anyway, point is, if you get this exception, I bet dollars to donuts there's a process running somewhere on your machine that is hogging your configured port.
Good luck!