简体   繁体   中英

I can access 127.0.0.1, but not http://localhost:8080

I have a problem. I am trying to run a simple JSP page from Eclipse: http://postimg.org/image/z268cl1s3/

But when I run this page i get a 404 error: http://postimg.org/image/h0rosix4z/

When I put in: localhost 127.0.0.1

in the browser it works fine: http://postimg.org/image/8js6hlsg3/

I can see eclipse is running it from localhost:8080, but when i type that in at the browser it gives me this error: http://postimg.org/image/7lbtfbf43/

Does anyone know how I can activate localhost on my mac. I looked up several tutorials, but i didnt find the answer. MySQL is also running fine on the computer, so I guess there is something that dont let me access [http://localhost:8080?]

Hope someone can help me? Best Regards Mads

There are two issues you are having:

  1. There is a difference between http://localhost/ (and its equivalent http://127.0.0.1 ) and http://localhost:8080 - the first uses port 80, the second 8080. The Tomcat server listens only to the latter, that is shown by the servers error messages, and not generic 404 messages. In other words, do not forget to add the 8080 port numbers to the end of the localhost url
  2. The Tomcat error messages show that the resources are not available, so I would look at what Java web applications are installed - eg the root web application is missing (the localhost:8080 url) for sure, and I am not sure whether your MySQL connector is.

Search google for how adding an entry to the hosts file on your mac.

You'll basically link localhost to 127.0.0.1 there

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM