Skip to content

Confusing error message when trying to render a template as a static web page #855

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
berlin-ab opened this issue May 13, 2014 · 9 comments
Labels
status: duplicate A duplicate of another issue

Comments

@berlin-ab
Copy link

Starter web applications should be able to return html files without any templating dependency.

screen shot 2014-05-13 at 11 30 30 am
screen shot 2014-05-13 at 11 30 36 am
screen shot 2014-05-13 at 11 30 45 am
screen shot 2014-05-13 at 11 30 52 am

@philwebb
Copy link
Member

Try putting your HTML in src/main/resources/static. The /templates folder is for templates that need to be processed by Thymeleaf etc.

@berlin-ab
Copy link
Author

Maybe the error message could specify the location that it is expecting to find files it is looking for?

@philwebb
Copy link
Member

It's a core Spring exception so we can't change it. Perhaps we could offer some strategy to log hints for specific exceptions. That might work well with the development environment idea (i.e. hints are only really needed during development).

@dsyer dsyer changed the title Circular view path error should not happen with a spring-boot-starter-web application. Confusing error message when trying to render a template as a static web page May 14, 2014
@berlin-ab
Copy link
Author

Here is an example of what happens when Rails can't find a template:

screen shot 2014-05-14 at 10 12 03 am

That's the kind of help that I'm hoping we can add to the Spring exceptions. "There was a problem. I (the framework) was looking for something here, or some configuration there..."

@boostrack
Copy link
Contributor

Is that not a template framework / web technology used ?

AFAIK e.g use Freemarker and you will have better errors than using
velocity.

My 2 cents is that a fancy error page depends on the web view technology
and not spring-boot related.

On Wed, May 14, 2014 at 4:13 PM, Adam Berlin [email protected]:

Here is an example of what happens when Rails can't find a template:

[image: screen shot 2014-05-14 at 10 12 03 am]https://cloud.githubusercontent.com/assets/87432/2972115/d88901ec-db71-11e3-8108-a6a86fbdc22e.png


Reply to this email directly or view it on GitHubhttps://github.com//issues/855#issuecomment-43085236
.

@berlin-ab
Copy link
Author

If you consider Spring Boot is the framework that we are interacting with, as shown here https://spring.io/platform I think that usability improvements for the underlying spring projects belong here in Boot.

@markfisher markfisher modified the milestone: 1.1.4 Jul 3, 2014
@philwebb philwebb removed this from the 1.1.4 milestone Jul 3, 2014
@jjwilliams
Copy link

So I hate to beat a dead horse here, but I am a Spring Boot new guy, coming from old Spring (its been 2+ years) and am running into this issue using Freemarker. Is there some configuration properties I need to set? Do I put the .html file in /templates or /static? From the error messages I receive it seems like /templates:

Cannot find template location(s): [classpath:/templates/] please add some templates, check your FreeMarker configuration, or set spring.freemarker.checkTemplateLocation=false

@snicoll
Copy link
Member

snicoll commented Jul 20, 2015

That does not seem to be the same issue to me. The exception message is pretty clear IMO: it tells you that because freemarker is active (sub-text: you added the dependency), then it expects some templates to be found in src/main/resources/templates (or wherever your resources directory of your project is). You html template must be put in /templates but given the exception message, that directory does not even exist.

Does that make sense?

@bclozel
Copy link
Member

bclozel commented Mar 21, 2018

Fixed in 1.3.x, but this error is still logged - see #2001 for the remaining parts to be fixed.

@bclozel bclozel closed this as completed Mar 21, 2018
@bclozel bclozel added status: duplicate A duplicate of another issue and removed priority: normal type: enhancement A general enhancement labels Mar 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

8 participants