简体   繁体   中英

Not able to see Tomcat homepage when starting Tomcat 8.0.27 from IntelliJ Ultimate Edition on Mac

I've installed Tomcat 8 (using brew install tomcat) on Yosemite (Mac OS).

Using ./startup.sh and ./shutdown.sh I can start and and stop Tomcat just fine. When I navigate to http://localhost:8080 , I can see the Tomcat homepage.

However, I'm trying to create a basic Hello World servlet in IntelliJ 15 Ultimate version (30 day trial), and have Tomcat home and Tomcat base to : /usr/local/Cellar/tomcat/8.0.27/libexec

When I start the application server from within IntelliJ, everything looks ok, the server log says "Connected to Server" and its looking like the following startup command has been executed - /usr/local/Cellar/tomcat/8.0.27/libexec/bin/catalina.sh run

I'm not confident everything is hanging together correctly because when I go to localhost:8080 there is no page served. Note at this point the Tomcat instance running from the terminal has been closed..

Any suggestions?

The localhost:8080/manager localhost:8080/admin and localhost:8080/ urls are basically web applications which are available under the TOMCAT_INSTALLATION_DIR/webapps/ directory. So when you start the tomcat using the startup.sh, it will by default use the TOMCAT_INSTALLATION_DIR as catalina.home and start to load all web applications under ${catalina.home}/webapps.

However, IDEs like intelliJ and Eclipse may use a temporary location as catalina.home. Which means that the tomcat home page and manager application will not be available to load when the server starts. This doesn't stop your application from loading. You can still access them from http://localhost:8080/yourApp or some similar URL.

If you run the below jsp file under intelliJ, It will give you the actual location from which location your web application is running

<html>
  <head>
      <title>Absolute Path</title>
  </head>
  Absolute Path is:<%= getServletContext().getRealPath("/") %> 
</html>

hope this helps

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