I generated a simple Greeting web application using Spring Initializr and choose war
as the packaging type. Starting it from the terminal with mvn spring-boot:run
and pointing my browser to http://localhost:8080/greeting
returns the expected response.
I followed this article for the deployment steps and modified pom.xml
so that to avoid including version numbers in the generated war:
<build>
<finalName>${artifactId}</finalName>
<plugins>
...
</build>
I build the war as usual with mvn clean install
and got the expected demo-spring-web.war
which I copied/pasted inside the apache-tomcat-10.0.4/webapp
folder.
Then I started the Tomcat bu running catalina.sh run
from the Tomcat bin
folder.
Tomcat started and displayed the demo-spring-web.war
to be successfully deployed:
11-Apr-2021 18:24:36.414 INFO [main] org.apache.catalina.startup.HostConfig.deployWAR
Deployment of web application archive [/Users/serguei/soft/apache-tomcat-10.0.4/webapps/demo-spring-web.war] has finished in [1,286] ms
But when I tried to access the deployed application at localhost:8080/demo-spring-web/greeting
, it returned 404 status.
What's wrong with that?