Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm trying to connect to localhost through my browser to learn some apache tomcat stuff.

When I tried to connect to localhost through Firefox, I couldn't; when I tried through IE, I could the first time, but not after that.

I'm using Windows 7, and changed the hosts file to point localhost to 127.0.0.1. I can successfully ping localhost and 127.0.0.1.

I have tried turning off my antivirus and my Windows Firewall, but to no avail.

What am I doing wrong?

share|improve this question
    
Do your Apache logs indicate that the connection request is even getting through to the httpd daemon? –  Ian C. Jan 31 '11 at 22:20
    
I'm not sure and don't know how to check. Tomcat seems to start up fine per the catalina logs other than a couple "Cannot find message associated with key ..." lines that aren't supposed to be a problem, and I do get a "Server startup in 2421 ms" message that, I think, indicates I have a good connection. –  Sceptre Jan 31 '11 at 22:27
    
tomcat is probably running as java.exe in your process list, btw. –  user110273 Dec 19 '11 at 23:48

2 Answers 2

Your problem comes from your Tomcat and Apache configurations.

When you type in localhost into IE, it automatically suposes you're connecting to port 80.

You're going to have to make sure that Apache is correctly configured to work with Tomcat.

You can also try out your tomcat server by connecting to:

http://localhost:portNumber

That is, add the port number you've configured TomCat for after a colon ... Try http://localhost:8080 for a start.

share|improve this answer
    
Was going to say the same thing but that doesn't tie in with it working first time in IE and then not working again. Unless the installer opened up the page automatically when it finished. –  Ciaran Jan 31 '11 at 22:24
    
Hi akseli. I should have mentioned that I already tried localhost:8080 and localhost:80 in both browsers. –  Sceptre Jan 31 '11 at 22:40
    
Also, the connector port for tomcat's server.xml is pointing to 8080. –  Sceptre Jan 31 '11 at 22:43
    
Can you telnet onto port 8080 via command prompt? –  Ciaran Jan 31 '11 at 22:48
1  
Hi Ciaran. I don't think so. Typing "telnet localhost 8080" gets me a message reading, "Connecting To localhost...Could not open connection to the host, on port 8080: Connect failed" –  Sceptre Jan 31 '11 at 22:50

Run tasklist from command prompt and note the process ID for Tomcat

Run netstat -noa and look for the the process ID you noted above. The 2nd column should show you something like 0.0.0.0:xxxxx. If there is an entry here for the process ID for Tomcat then Tomcat is definitely listening for connections properly. If not, Tomcat's broken and you may need to reinstall it or dive into the Tomcat logs (since it seems to be running but not listening properly).

There might be a few entries for the process ID, each giving a different port. Try them all because I believe you can forward one port to another in Tomcat.

share|improve this answer
    
When running tasklist, I don't see anything about tomcat or apache, but using netstat, I see that some ports have a LISTENING state, but that 127.0.0.1:8080 and 127.0.0.1:80 aren't in the list at all, so I assume that those ports aren't listening. I then tried to ping 127.0.0.1:8080 and 127.0.0.1:80 and that doesn't come back, while 127.0.0.1 does. Have I turned off the 80 and 8080 ports somehow? –  Sceptre Feb 1 '11 at 0:44
    
If you don't see anything about Tomcat or Apache then they probably aren't running or might have a different process name. If you're using Windows Vista or Windows 7 you can open up task manager instead, click the services tab, right click the Apache/Tomcat service and click go to process (only available if the service is actually running). You can get the process ID from there if the column is visible. If not, go to view > select columns... > check the PID checkbox –  Ciaran Feb 1 '11 at 0:49
    
You can't ping an address with a port number on the end. telnet is the way to find out if the port is listening. I'm convinced that Apache/Tomcat isn't actually running btw, if it wasn't in tasklist –  Ciaran Feb 1 '11 at 0:52
    
I'm going to reinstall Tomcat and see if that does anything. –  Sceptre Feb 1 '11 at 1:13
    
Were you able to verify if a process existed in task manager for it? –  Ciaran Feb 1 '11 at 1:19

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.