本文介绍了在IntelliJ IDEA中为Tomcat设置了哪些应用程序上下文?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

到目前为止,我通过 catalina.bat start 脚本在windows命令中运行Tomcat服务器(v.7.0.26)。如果我想部署我的Web应用程序,我必须通过Maven构建它并复制WAR以指定Tomcat部署目录。服务器启动时一切正常。

So far I run Tomcat server (v. 7.0.26) in windows command by catalina.bat start script. If I want to deploy my web app I have to build it by Maven and copy WARs to specify Tomcat deploy directory. When server start everything is ok.

现在我尝试将我的网络应用程序连接到IntelliJ IDEA Ultimate 2017.1.4。我的应用有多个WAR。在运行/调试配置我添加新的Tomcat服务器。在部署标签中,我有:

Now I try to connect my web app to IntelliJ IDEA Ultimate 2017.1.4. My app have multiple WARs. At Run/Debug Configuration I add new Tomcat Server. At the Deployment tab I have:

我必须选择应用程序上下文,但如果我为多个工件设置为空白,则会收到错误重复上下文路径 ''。同样的情况是我选择 / 。如果我尝试运行服务器没有部署。我应该设置哪个应用程序上下文?

I have to choose Application context but if I set blank for more than one artifact I get error Duplicate context path''. Same situation is when I choose /. If I try to run server nothing deploy. Which application context I should set?

推荐答案

应用程序上下文将成为您在访问时必须在浏览器中输入的URL的一部分应用程序。您可以使用war文件的名称:

The application context will be part of the URL you have to enter in your browser when accessing the application. You could use the name of your war file:

kb-hook

然后,您可以在浏览器中输入地址并找到该应用程序。 (鉴于您的Tomcat在端口8080上运行)您可能必须在该URL后面的战争中添加资源的路径。

Then you can enter the adress in your browser and find the application. (Given your Tomcat runs on port 8080) You will maybe have to add a path to a resource within the war behind that URL.

http://localhost:8080/kb-hook/

您也可以选择其他名称,但经常选择war文件的名称。

You could also choose another name, but the name of the war file is chosen quite often.

这篇关于在IntelliJ IDEA中为Tomcat设置了哪些应用程序上下文?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-27 10:25