I'm starting a completely new project in IntelliJ v2022.2.2 but when I try to run it it shows the webpage ''Hello world'' and then when I click on the pregenerated link "Hello servlet" I'm getting this:
HTTP Status 404 – Not Found Type Status Report Message The requested resource [/webhusk_war_exploded/hello-servlet] is not available Description The origin server did not find a current representation for the target resource or is not willing to disclose that one exists. Apache Tomcat/10.0.27
This is my settings for the new project: Generators: Jakarta EE Template: Web application Application server: Tomcat 10.0.27 Language: Java Build system: Maven JDK: 19 oracle openJDK
NEXT Version: Java EE 8
If I change the version from Java EE 8 to Jakarta EE 9 it is working, but I need it to work in Java. Does anyone know if there is a bug somewhere in either IntelliJ or Tomcat that I am not aware of?
CodePudding user response:
The project generated this way is incompatible with Tomcat 10, that's why you observe the 404 error. The cause of this problem is a change Servlet API namespace from javax.* (Tomcat 9) to jakarta.* (Tomcat 10). If you want to continue using Java EE 8, I recommend you use Tomcat 9 instead 10.2.7.