Reputation: 649
I'm developing a Spring Boot application build with Maven. In my local machine is working, but when I run the .jar in a virtual host for testing purposes, I get this exception:
org.thymeleaf.exceptions.TemplateInputException:
Error resolving template "/admin/rates/test", template might not exist or might not be
accessible by any of the configured Template Resolvers
Those are the configuration elements that I have set for Thymeleaf:
In the pom.xml:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-java8time</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity4</artifactId>
</dependency>
And in the heading of each html page:
<html xmlns:th="http://www.thymeleaf.org">
The virtual host is a droplet from Digital Ocean, running on Ubuntu 16.04.2, and with this java version:
openjdk version "9-internal"
OpenJDK Runtime Environment (build 9-internal+0-2016-04-14-195246.buildd.src)
OpenJDK 64-Bit Server VM (build 9-internal+0-2016-04-14-195246.buildd.src, mixed mode)
In my local workstation I have a Windows 10, and I run the application with NetBeans instead of java -jar MyApplication.jar
, at the Ubuntu terminal.
I may be missing something, so any help would be much appreciated.
Upvotes: 0
Views: 229
Reputation: 224
I Had the same issue and i solved it by removing the slash (/) at the begining of the name of the template returned by the controller method. So in your cas i think you should return "admin/rates/test" rather than "/admin/rates/test". And this advice still available for the fragments incusion. for example you should write
<th:block th:replace="layout/footer-frag.html::footer"></th:block>
rather than
<th:block th:replace="/layout/footer-frag.html::footer"></th:block>
Upvotes: 2