简体   繁体   English

如何在 tomcat 上运行选择的 webapp

[英]how to run chosen webapp on tomcat

I've tried to run webapp on tomcat without using IDE (IntelliJ) for the first time.我第一次尝试在不使用 IDE (IntelliJ) 的情况下在 tomcat 上运行 webapp。

I deployed.war file of my project in /webapps/ and started tomcat server.我在 /webapps/ 中部署了我的项目的.war 文件并启动了 tomcat 服务器。 I have previously created different webapps on the same 8080 port and I don't really know how to change the priority in which those apps are taking over this port.我之前在同一个 8080 端口上创建了不同的 webapps,但我真的不知道如何更改这些应用程序接管此端口的优先级。

I don't really want to change the port, because it's obvious and I was thinking maybe about the right configuration of web.xml file or maybe running a new instance of tomcat without other webapps deployed.我真的不想更改端口,因为这很明显,我正在考虑 web.xml 文件的正确配置,或者可能运行 tomcat 的新实例而不部署其他 webapp。 I think that creating new instance of a server is too much for now.我认为现在创建服务器的新实例太多了。

Can you tell me is there any way I can choose which webapp will start on port 8080 first?你能告诉我有什么办法可以选择首先在端口 8080 上启动的 webapp 吗?

content of tomcat /webapps: tomcat /webapps 的内容:

$ ll
total 45
drwxr-xr-x 1 ThinkPad 197121    0 cze  4 21:29 docs/
drwxr-xr-x 1 ThinkPad 197121    0 cze  4 21:29 examples/
drwxr-xr-x 1 ThinkPad 197121    0 cze  4 21:29 host-manager/
drwxr-xr-x 1 ThinkPad 197121    0 lip 14 14:32 jspwebapp_war/
drwxr-xr-x 1 ThinkPad 197121    0 cze  4 21:29 manager/
drwxr-xr-x 1 ThinkPad 197121    0 cze  4 21:29 ROOT/
drwxr-xr-x 1 ThinkPad 197121    0 cze 22 13:31 sample/
-rw-r--r-- 1 ThinkPad 197121 4606 cze 22 13:31 sample.war
drwxr-xr-x 1 ThinkPad 197121    0 lis  9 22:59 teltuskoDemoApp/
-rw-r--r-- 1 ThinkPad 197121  342 lis  9 21:15 teltuskoDemoApp.war
drwxr-xr-x 1 ThinkPad 197121    0 cze 30 10:39 TestowyWebApp/
-rw-r--r-- 1 ThinkPad 197121 2215 cze 22 14:32 TestowyWebApp.war
drwxr-xr-x 1 ThinkPad 197121    0 lip 21 13:46 twitter_war/

Some of those projects were made with the help of spring and IntelliJ其中一些项目是在 spring 和 IntelliJ 的帮助下完成的

My project contins web/index.jsp and also web/WEB-INF/web.xml:我的项目包含 web/index.jsp 以及 web/WEB-INF/web.xml:

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
         version="4.0">
</web-app>

If there is an application already running in port 8080, another application won't be able to start using port 8080.如果已经在 8080 端口运行了一个应用程序,那么另一个应用程序将无法使用 8080 端口启动。

You have to terminate the application which is using port 8080, before starting an application using the same port.在启动使用同一端口的应用程序之前,您必须终止使用端口 8080 的应用程序。

I believe the best solution is to start the applications in different ports.我相信最好的解决方案是在不同的端口启动应用程序。

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

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