Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Spring Basics Creating Controllers and Views Using Thymeleaf to Serve HTML

Vinay R
Vinay R
691 Points

Error in finding template location

Cannot find template location: classpath:/templates/ (please add some templates or check your Thymeleaf configuration)

I have my home.html in templates folder still i am getting this error.

1 Answer

Alexander Nikiforov
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,175 Points

Judging by other people with same problems, I think you are using Eclipse. And it seems that your IDE tries to look for templates directory in classpath/templates, not in the classpath/resources/templates. Because otherwise way error should look more like

Cannot find template location: class path resource [templates/]

Try to create manually templates where the program does, in classpath/templates ( e.g. src/main/templates , hopefully you have this project structure). It helped this guy here:

https://github.com/spring-projects/spring-boot/issues/424