Deployment issues in Spring Boot project
Hello, I am a newcomer using the Hobby Plan. My project is built on the Spring Boot platform and runs fine on my local machine, but when I deploy it, I encounter an error related to ThymeLeaf. Here is the error log:
2023-09-01T15:34:44.565Z ERROR 1 --- [nio-6498-exec-5] org.thymeleaf.TemplateEngine : [THYMELEAF][http-nio-6498-exec-5] Exception processing template "/client/index": Error resolving template [/client/index], template might not exist or might not be accessible by any of the configured Template Resolvers
@project: 85eadb05-1f13-4118-bdf2-067247f8ec87
@environment: c1a03bd1-e816-4b7c-8fa8-b762c8ff2c0f
@service: d89d3294-6dea-48e3-8f36-5059abdd7229
@deployment: 13118411-5b51-4992-bc7a-d6cab21e47ff
@replica: 9714fd21-a33b-45f7-bb7d-875a768537e7
24 Replies
Project ID:
85eadb05-1f13-4118-bdf2-067247f8ec87,c1a03bd1-e816-4b7c-8fa8-b762c8ff2c0f,d89d3294-6dea-48e3-8f36-5059abdd7229,13118411-5b51-4992-bc7a-d6cab21e47ff,9714fd21-a33b-45f7-bb7d-875a768537e7
@interstellartaco hello friendly neighbourhood Java dev
I really need help. I hope everyone can assist me.
don't know if aleks is available right now, he'll come around when he has the time
Thank you. But can he trace and identify the issue from that log? I'm concerned that since the error description is limited, it might be challenging for him to trace
this is true, please provide the full deployment log in a txt file
are you using a relative path to that template file
I have declared the Thymeleaf path to the templates directory in the application.yaml file:
spring:
thymeleaf:
prefix: classpath:/templates/
suffix: .html
I have also declared a route so that when accessing the corresponding URL, it will go to the file: client/index.html:
@GetMapping(value = {"/", "/home", "/trang-chu"})
public ModelAndView index() {
ModelAndView view = new ModelAndView("/client/index");
return view;
}
And here is the file path of that file in the project:
src/main/resources/templates/client/index.html
I have also declared the dependent libraries in the pom.xml file:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>nz.net.ultraq.thymeleaf</groupId>
<artifactId>thymeleaf-layout-dialect</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity6</artifactId>
</dependency>
these look like absolute paths, try using relative paths
"No, it is a relative path
alright
deadline is pressing on me. I need urgent assistance :(((((((
this is comunity help, if no one here knows java and how to solve your problem you may not get an answer unfortunatly
Thank you. Is there any way to receive support from the Railway technical team? I believe this error is internal to their system
I assure you it's not a platform issue, something with your code. but to receive support from the team you'd need to be on the pro plan or there would need to be something wrong with the platform, this is just a code issue
I have cloned this project to another machine, and it runs fine on that machine. I'm quite stuck on this issue :((
unfortunatly, it runs on my machine does not rule out a code issue
I have redeployed on Railway several times, but the error still occurs. However, on my local machines where I deploy this project, the error doesn't occur. It's really difficult to troubleshoot
sorry but the "it runs on my machine" does not rule out a code issue
Yes, I understand. What I mean is that since I cannot reproduce the error, resolving it has become a deadlock
you can always log stuff and try different path styles, etc. it would not be wise to wait for someone to come with an answer without trying to work through this problem yourself too
Thank you. During the past few hours, alongside troubleshooting the issue, I also posted the question on the community. And I'm still actively seeking ways to resolve the problem.
Try removing the leading / from the view path.