Skip to content
Advertisement

HTTP Status 404 – Not Found: for controller – no view resolvers found in Idea

I have the following Spring MVC code:

config files:

JavaScript
JavaScript

contollers:

JavaScript
JavaScript

I get the following errors when I deploy:

enter image description here

enter image description here

Accessing the /api page, however, works just fine.

EDIT:

After replacing home.html with home, the error is still present – both in IDE and the 404 in browser:

enter image description here

Also maybe it’s relevant – I get this pop up at one of the config classes:

enter image description here

Advertisement

Answer

The problem was me using JstlView.class and ViewResolver with .html pages that I wanted to render via thymeleaf. If I change the code inside WebConfig to:

JavaScript

and replace home.html with home.jsp it works just fine.

Not sure how I’d need to do with thymeleaf. I decided to go with rest controllers instead, but maybe someone would be able to post thymeleaf-friendly version of the code later. I was recommended this: https://www.thymeleaf.org/doc/tutorials/3.0/thymeleafspring.html for writting a correct method. Might come back to this answer to edit later.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement