【问题标题】:Disable adding appName to url while running war file on external tomcat [duplicate]在外部tomcat上运行war文件时禁用将appName添加到url [重复]
【发布时间】:2014-07-16 01:04:45
【问题描述】:

我按照春季官方教程“Converting a Spring Boot JAR Application to a WAR using Maven”link.

生成的war文件部署在tomcat上,可在以下位置访问:

a)http://localhost:8080/${AppName}/
http://localhost:8080/gs-convert-jar-to-war-maven-0.1.0/  in case of the tutorial.

我需要更改哪些配置才能让我的应用程序直接在

上可用
http://localhost:8080/  (without the appName) 

在 tomcat 上运行我的战争文件时?

谢谢,

罗恩

【问题讨论】:

标签: java tomcat tomcat7 spring-boot


【解决方案1】:

您必须更改应用程序的 contextRoot。 有 3 个地方可以做到这一点:

  • 在 WAR 文件中:META-INF/context.xml
  • 在 TOMCAT_HOME/conf/Catalina/localhost/xxx.xml 中
  • 或在 server.xml 文件中,但最好不要在此处更改。

在这些地方之一,你可以添加这个:

<Context
        path="/"
        docBase="/TOMCAT_HOME/webapps/yourapp"
    />

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2016-08-23
  • 1970-01-01
  • 2011-11-10
  • 1970-01-01
  • 2010-09-13
  • 2012-07-29
  • 1970-01-01
  • 2015-05-08
相关资源
最近更新 更多