繁体   English   中英

如何在 tomcat 上运行选择的 webapp

[英]how to run chosen webapp on tomcat

我第一次尝试在不使用 IDE (IntelliJ) 的情况下在 tomcat 上运行 webapp。

我在 /webapps/ 中部署了我的项目的.war 文件并启动了 tomcat 服务器。 我之前在同一个 8080 端口上创建了不同的 webapps,但我真的不知道如何更改这些应用程序接管此端口的优先级。

我真的不想更改端口,因为这很明显,我正在考虑 web.xml 文件的正确配置,或者可能运行 tomcat 的新实例而不部署其他 webapp。 我认为现在创建服务器的新实例太多了。

你能告诉我有什么办法可以选择首先在端口 8080 上启动的 webapp 吗?

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/

其中一些项目是在 spring 和 IntelliJ 的帮助下完成的

我的项目包含 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>

如果已经在 8080 端口运行了一个应用程序,那么另一个应用程序将无法使用 8080 端口启动。

在启动使用同一端口的应用程序之前,您必须终止使用端口 8080 的应用程序。

我相信最好的解决方案是在不同的端口启动应用程序。

暂无
暂无

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

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