简体   繁体   English

从Mac上的IntelliJ Ultimate Edition启动Tomcat 8.0.27时看不到Tomcat主页

[英]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). 我已经在优胜美地(Mac OS)上安装了Tomcat 8(使用brew install tomcat)。

Using ./startup.sh and ./shutdown.sh I can start and and stop Tomcat just fine. 使用./startup.sh和./shutdown.sh我可以启动和停止Tomcat。 When I navigate to http://localhost:8080 , I can see the Tomcat homepage. 当我导航到http:// localhost:8080时 ,我可以看到Tomcat主页。

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 但是,我试图在IntelliJ 15 Ultimate版本(30天试用版)中创建一个基本的Hello World servlet,并将Tomcat主页和Tomcat基础设置为:/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 当我从IntelliJ中启动应用程序服务器时,一切正常,服务器日志显示“已连接到服务器”,并且看起来已执行以下启动命令-/usr/local/Cellar/tomcat/8.0.27/libexec/ bin / catalina.sh运行

I'm not confident everything is hanging together correctly because when I go to localhost:8080 there is no page served. 我不确定所有内容能否正确组合在一起,因为当我转到localhost:8080时,没有页面提供。 Note at this point the Tomcat instance running from the terminal has been closed.. 请注意,此时从终端运行的Tomcat实例已关闭。

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. localhost:8080/manager localhost:8080/adminlocalhost:8080/ url基本上是Web应用程序,可在TOMCAT_INSTALLATION_DIR/webapps/目录下找到。 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. 因此,当您使用startup.sh启动tomcat时,默认情况下它将使用TOMCAT_INSTALLATION_DIR作为catalina.home并开始将所有Web应用程序加载到${catalina.home}/webapps.

However, IDEs like intelliJ and Eclipse may use a temporary location as catalina.home. 但是,像intelliJEclipse这样的IDE可能会将临时位置用作catalina.home。 Which means that the tomcat home page and manager application will not be available to load when the server starts. 这意味着当服务器启动时,tomcat主页和管理器应用程序将无法加载。 This doesn't stop your application from loading. 这不会阻止您的应用程序加载。 You can still access them from http://localhost:8080/yourApp or some similar URL. 您仍然可以从http:// localhost:8080 / yourApp或一些类似的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 如果您在intelliJ下运行以下jsp文件,它将为您提供Web应用程序运行所在的实际位置

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

hope this helps 希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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