Issue
The IDE I am developing on is Intellij.
I am trying to launch my spring project with an external version of tomcat. I have created the base of the project and did a "mvn clean package" command in the console to generate a war file. This is what is contained in my pom.xml.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.3</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.myName</groupId>
<artifactId>ResumeWebsite</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>ResumeWebsite</name>
<description>Website for containing personal projects</description>
<properties>
<java.version>18</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>MyWebsite</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
The following screenshots are what I have in my classes as well as what tomcat displays in command prompt when running the batch file.
When I try to go to the route localhost:8080/MyWebsite/print I get a 404 error. I had then tried localhost:8080/print and still get a 404 error.
In my server.xml file for my tomcat server this is what is shown for my Http and AJP connectors
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
<Connector protocol="AJP/1.3"
address="::1"
port="8009"
redirectPort="8443"
secretRequired="false" />
This is also what is contained in my webapps folder for my tomcat server.
If any more information is needed please feel free to ask. Thank you for your help.
Solution
Tomcat10 is JakartaEE not JavaEE. Use Tomcat 9. As stated by the person who commented to my post. This fixed my issues.
Answered By - JebediahKermin
Answer Checked By - Pedro (JavaFixing Volunteer)