【发布时间】:2020-03-06 04:02:57
【问题描述】:
我第一次尝试在不使用 IDE (IntelliJ) 的情况下在 tomcat 上运行 webapp。
我在 /webapps/ 中部署了我的项目的 .war 文件并启动了 tomcat 服务器。我之前在同一个 8080 端口上创建了不同的 webapps,但我真的不知道如何更改这些应用程序接管此端口的优先级。
我真的不想更改端口,因为这很明显,我在考虑可能是 web.xml 文件的正确配置,或者可能在没有部署其他 webapps 的情况下运行新的 tomcat 实例。我认为现在创建服务器的新实例太多了。
你能告诉我有什么方法可以让我选择哪个 webapp 首先在端口 8080 上启动吗?
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>
【问题讨论】:
标签: java jsp servlets web-applications tomcat8