Home > database >  IntelliJ project returns 404 in Tomcat while it works fine in GlassFish
IntelliJ project returns 404 in Tomcat while it works fine in GlassFish

Time:12-16

Description

Hello, I created a new web app(jakarta ee) using intellij idea.

I have not changed any file. All the files that exist in my project are the default files.

I tried to view the project by using the default configuration as described by many sites(that is using the war:exloded artifact) and I could only see the home page. When I tried to click on the link that it has on the homepage I got a 404 error.

The strange thing is that when I tried viewing the exact same application with the war:exploded artifact but the glassfish server, it all worked as expected.

How to reproduce:

  1. Create a new project using the Intellij idea.
  2. Create a new configuration using tomcat and in the deployment tab apply the war:exploded artifact
  3. try to run the deployment and enter the url in your browser.
  4. click on the default link on the webpage available
  5. See the 404 error
  6. Create the same configuration with glassfish and run it
  7. Watch the webpage work as expected

What did I try

I didn't think of many things to try. I tried changing the artifact that was being deployed but none of the available artifacts seemed to be working. So I have no idea what to do. But there could be an artifact that I missed to test.

CodePudding user response:

This will occur if you are trying to use incompatible version of Tomcat with Jakarta EE. new web project wizard

For example, if you are using Servlet 5.0.0, like in the photo, then you have to have at least Tomcat 10.0.x. Installing earlier version will simply not do.

  • Related