I was trying to deploy spring boot micro-service on the tomcat server but was unable to get any response. The url was showing 404 error then I decided to go from very basic so I created a simple spring boot project with Spring Boot Initializer. There I choose
- war as packaging.
- java version 16 (as I only have this on my machine).
- Added Spring Web dependency.
With this setting spring initializer automatically added necessary stuff like war packaging
, tomcat dependency
, spring web dependency
and also created ServletInitializer
class for me.
After that I opened the downloading project in netbeans 12
and made just a few changes i.e.
- Added main class in the
pom.xml
file with<start-class>
tag and annotated main class with@RestController
and exposed 1 endpoint which return simple string. - Then from the project's main folder I ran the command
mvn package
also triedmvn clean install
as deployment with the 1st command was unsuccessful.
Here are my configuration
Environment Variables:
System Variables
- CATALINA_HOME:
D:\Inzimam Tariq\apache-tomcat-10.0.10
. - JAVA_HOME:
C:\Program Files\Java\jdk-16.0.2
- Relevent values in Path Variable:
C:\Program Files\Common Files\Oracle\Java\javapath
,D:\Inzimam Tariq\apache-maven-3.8.2\bin
, andC:\Program Files\Java\jdk-16.0.2\bin
.
User Variable
- MAVEN_HOME:
D:\Inzimam Tariq\apache-maven-3.8.2\bin
.
I'm using windows 10 64-bit. Tomcat manager shows the app as deployed but when I click on that it shows 404
. My JDK folder does not show JRE folder so I searched over internet and found that Java does not include JRE now. I also tried to rename my war file to the project name as some articles suggested that i.e. abc.war
from abc-0.0.1-SNAPSHOT
but still error is the same.
Please can someone point me to the right direction? Regards