Nuñito Calzada
Nuñito Calzada

Reputation: 1718

Thymeleaf + Spring Boot: Error resolving template

I have a basic SpringBoot app. using Spring Initializer, embedded Tomcat, Thymeleaf template engine, and package as an executable JAR file.

I have this properties in the application.properties

server.contextPath=/pecador
server.port=5678

Running the through Eclipse I can access to the application and everything is fine

http://localhost:5678/pecador/login

But when I deploy the application in the server and running it with the command:

sudo nohup java -jar pecadorCloudApp-0.0.1-SNAPSHOT.jar & /tmp 2>> /dev/null >> /dev/null &

and I try http://149.152.231.117:5678/pecador/login

I got this error:

org.thymeleaf.exceptions.TemplateInputException: Error resolving template "/pecador/login/login", template might not exist or might not be accessible by any of the configured Template Resolvers

and unzipping the jar the template is there, under:

pecadorAPP.jar/BOOT-INF/classes/templates/pecador/login/login.html

Upvotes: 2

Views: 8571

Answers (1)

isah
isah

Reputation: 5351

It looks like you're returning the view name with a leading slash(/). Just return pecador/login/login and it should work in both environments.

Check this: https://github.com/spring-projects/spring-boot/issues/1744

Upvotes: 4

Related Questions