Tengo este proyecto
@GetMapping(value = { "/cliente/listar", "cliente" })
public String listar(Model model) {
model.addAttribute("titulo", "Lista de Clientes");
model.addAttribute("clientes", clienteService.findAll());
return "/cliente/NewFile";
}
Estando en el navegador, cuando trato de ingresar a la ruta del endpoint me sale el siguiente error:
Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback.
Sat Apr 24 00:25:57 UTC 2021 There was an unexpected error (type=Internal Server Error, status=500).
Y esto es lo que aparece en los logs de Heroku:
2021-04-24T00:48:27.706944+00:00 heroku[router]: at=info method=GET path="/cliente/listar" host=pruebafinalassasas.herokuapp.com request_id=836c140d-71a0-40a1-8183-5f564e9d3dd0 fwd="89.40.206.190" dyno=web.1 connect=0ms service=25ms status=500 bytes=482 protocol=https 2021-04-24T00:48:39.251703+00:00 heroku[router]: at=info method=GET path="/cliente/listar" host=pruebafinalassasas.herokuapp.com request_id=ba740297-c7d7-4444-9df5-77bf32231537 fwd="89.40.206.190" dyno=web.1 connect=0ms service=19ms status=500 bytes=482 protocol=https 2021-04-24T00:48:39.245896+00:00 app[web.1]: 2021-04-24 00:48:39.245 ERROR 4 --- [io-24752-exec-1] org.thymeleaf.TemplateEngine : [THYMELEAF][http-nio-24752-exec-1] Exception processing template "/cliente/NewFile": Error resolving template [/cliente/NewFile], template might not exist or might not be accessible by any of the configured Template Resolvers 2021-04-24T00:48:39.245906+00:00 app[web.1]: 2021-04-24T00:48:39.245917+00:00 app[web.1]: org.thymeleaf.exceptions.TemplateInputException: Error resolving template [/cliente/NewFile], template might not exist or might not be accessible by any of the configured Template Resolvers 2021-04-24T00:48:39.245920+00:00 app[web.1]: at org.thymeleaf.engine.TemplateManager.resolveTemplate(TemplateManager.java:869) ~[thymeleaf-3.0.12.RELEASE.jar!/:3.0.12.RELEASE] 2021-04-24T00:48:39.245921+00:00 app[web.1]: at org.thymeleaf.engine.TemplateManager.parseAndProcess(TemplateManager.java:607) ~[thymeleaf-3.0.12.RELEASE.jar!/:3.0.12.RELEASE]
Aclaro que ejecutandolo local funciona sin problemas pero cuando despliego en heroku me arroja esto que comento.
return Class.getResource("/cliente/NewFile");
. Haz un build del código y pruebalo localmente desde el .jar y si anda prueba desde Heroku para descartar si es esto o no