Java Intro to Java Web Development with Spark Diving into Web Development Sending Responses

Error Please Help

I'm following all the steps but it shows "500 Internal Error"

Compiler says

ERROR spark.webserver.MatcherFilter - org.eclipse.jetty.io.RuntimeIOException: java.io.FileNotFoundException: /templates/index.hbs

4 Answers

Alexander Nikiforov
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,136 Points

Does the structure of your project looks exactly like his one ?

What is important that structure is exactly like his one Like at video: 07:42

https://teamtreehouse.com/library/intro-to-java-web-development-with-spark/diving-into-web-development/sending-responses

Your template files should be in the /src/main/resources/templates.

Could you make a screenshot of your structure exactly like in video at 07:42, so that resources are seen.

There is clearly the problem that location of template files cannot be found.

So if by any chance your templates directory is not in the /src/main/recources/templates as you can see in video 07:42, you program should not work...

Does it make more sense now ?

Hi Anish,

java.io.FileNotFoundException simply means that the file "index.hbs" was not found in the directory you've specified somewhere in your code; in this course video around 08:20 - 08:26, this was specified in Main.java from /src/main/java/<your folder name>/Main.java.

Your "index.hbs" should be in /src/main/resources/templates as Alexander mentioned above.

Akshay Ramdasi
Akshay Ramdasi
13,790 Points

I am getting another warings about "org.slf4j.impl.StaticLoggerBinder"

the warnings are

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to no-operation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.

Process finished with exit code 100

please help me! Also I am unable to view the page showing Welcome students. I have restarted server but getting 404 file not found message.

Alexander Nikiforov
Alexander Nikiforov
Java Web Development Techdegree Graduate 22,136 Points

https://teamtreehouse.com/community/i-got-an-error-slf4j-failed-to-load-class-orgslf4jimplstaticloggerbinder

That should solve Failed to load class error.

If you don't see a page. Paste complete project on Github. Or at least Main and template files.

Also download files for project for this video and compare them with yours for errors.

And last but not the least, here is the GitHub link to Craigs project

https://github.com/treehouse-projects/java-spark-course-ideas

Akshay Ramdasi
Akshay Ramdasi
13,790 Points

Thanks, You solved my problem. I am getting to know that why the treehouse have best developers training in the world!!