How can I create (and access) a deployable war based on the Serving Web Content with Spring MVC guide?
It feels like the steps have all succeeded but then when trying to view the page, a 404 error is returned... possibly I am just trying to access the wrong url?
The tutorial works wonderfully when creating and running the jar but when I attempt to access a web page from the war, it is resulting in a 404 error.
Step 1. Create a deployable war file
- Make Application class extend SpringBootServletInitializer
- This leads to Packaging executable jar and war files, which involves changing the packaging tag, and marking embedded container dependencies as “provided”
- Package the war file with: mvn package
Step 2. Deploy!
- Copy gs-serving-web-content-0.1.0.war into Tomcat's webapps directory
- Tomcat then creates the directory gs-serving-web-content-0.1.0
- Tomcat console says:
deployWAR INFO: Deployment of web application archive C:\Programs\apache-tomcat-7.0.56\web apps\gs-serving-web-content-0.1.0.war has finished in 2,746 ms
Step 3. View the webpage (This is where it all goes wrong)
- http://localhost:8080/greeting?name=AAA: 404 error (from Tomcat)
- http://localhost:8080/gs-serving-web-content-0.1.0/greeting?name=AAA: 404 error (from Tomcat)
Any help would be greatly appreciated!