guestbook
guestbook copied to clipboard
Issue with rendering home.html, Ch. 1, Pg 15
I've been working through the first chapter and without any major issue when I came across the part in chapter 1, page 15 wherein the HTTP routes are defined and the home.html page modified. I have followed it as exactly as possible (And started an entirely new project from scratch, following all the instructions again just to make sure it wasn't a typo somewhere in the first one) but I get this same error:
java.io.FileNotFoundException at / /Users/user/Desktop/ClojStoof/guestbook/resources/html/{:messages ({:id 1, :name "Bob", :message "Hello, world!", :timestamp (No such file or directory)
When I ran lein test
this is what I got: (Not formatted as code as it didn't seem to render properly in the preview)
2019-03-24 16:27:58,032 [main] DEBUG org.jboss.logging - Logging Provider: org.jboss.logging.Slf4jLoggerProvider
lein test guestbook.test.db.core 2019-03-24 16:28:00,839 [main] INFO migratus.core - Starting migrations 2019-03-24 16:28:00,884 [main] DEBUG migratus.migrations - Looking for migrations in #object[java.io.File 0x46a72c1e /Users/user/Desktop/ClojStoof/guestbook/resources/migrations] 2019-03-24 16:28:00,909 [main] INFO migratus.core - Ending migrations
lein test guestbook.test.handler
java.io.FileNotFoundException: /Users/user/Desktop/ClojStoof/guestbook/resources/html/{:messages ()} (No such file or directory)
at java.base/java.io.FileInputStream.open0(Native Method)
at java.base/java.io.FileInputStream.open(FileInputStream.java:219)
at java.base/java.io.FileInputStream.
at ring.middleware.absolute_redirects$wrap_absolute_redirects$fn__11268.invoke(absolute_redirects.clj:47)
at ring.middleware.resource$wrap_resource_prefer_resources$fn__11118.invoke(resource.clj:25)
at ring.middleware.content_type$wrap_content_type$fn__11216.invoke(content_type.clj:34)
at ring.middleware.default_charset$wrap_default_charset$fn__11240.invoke(default_charset.clj:31)
at ring.middleware.not_modified$wrap_not_modified$fn__11182.invoke(not_modified.clj:61)
at ring.middleware.x_headers$wrap_x_header$fn__9597.invoke(x_headers.clj:22)
at ring.middleware.x_headers$wrap_x_header$fn__9597.invoke(x_headers.clj:22)
at ring.middleware.x_headers$wrap_x_header$fn__9597.invoke(x_headers.clj:22)
at guestbook.middleware$wrap_internal_error$fn__11342.invoke(middleware.clj:21)
at guestbook.test.handler$fn__21463$fn__21464.invoke(handler.clj:22)
at guestbook.test.handler$fn__21463.invokeStatic(handler.clj:21)
at guestbook.test.handler$fn__21463.invoke(handler.clj:20)
at clojure.test$test_var$fn__9707.
FAIL in (test-app) (handler.clj:23) main route invoke(test.clj:717) at clojure.test$test_var.invokeStatic(test.clj:717) at clojure.test$test_var.invoke(test.clj:708) at clojure.test$test_vars$fn__9733$fn__9738.invoke(test.clj:735) at clojure.test$default_fixture.invokeStatic(test.clj:687) at clojure.test$default_fixture.invoke(test.clj:683) at clojure.test$test_vars$fn__9733.invoke(test.clj:735) at guestbook.test.handler$eval21459$fn__21460.invoke(handler.clj:18) at clojure.test$compose_fixtures$fn__9701$fn__9702.invoke(test.clj:694) at clojure.test$default_fixture.invokeStatic(test.clj:687) at clojure.test$default_fixture.invoke(test.clj:683) at clojure.test$compose_fixtures$fn__9701.invoke(test.clj:694) at clojure.test$test_vars.invokeStatic(test.clj:731) at clojure.test$test_all_vars.invokeStatic(test.clj:737) at clojure.test$test_ns.invokeStatic(test.clj:758) at clojure.test$test_ns.invoke(test.clj:743) at user$eval21253$fn__21314.invoke(form-init11109726989949801998.clj:1) at clojure.lang.AFn.applyToHelper(AFn.java:156) at clojure.lang.AFn.applyTo(AFn.java:144) at clojure.core$apply.invokeStatic(core.clj:667) at clojure.core$apply.invoke(core.clj:660) at leiningen.core.injected$compose_hooks$fn__21085.doInvoke(form-init11109726989949801998.clj:1) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invokeStatic(core.clj:665) at clojure.core$apply.invoke(core.clj:660) at leiningen.core.injected$run_hooks.invokeStatic(form-init11109726989949801998.clj:1) at leiningen.core.injected$run_hooks.invoke(form-init11109726989949801998.clj:1) at leiningen.core.injected$prepare_for_hooks$fn__21090$fn__21091.doInvoke(form-init11109726989949801998.clj:1) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.lang.AFunction$1.doInvoke(AFunction.java:31) at clojure.lang.RestFn.invoke(RestFn.java:408) at clojure.core$map$fn__5851.invoke(core.clj:2755) at clojure.lang.LazySeq.sval(LazySeq.java:42) at clojure.lang.LazySeq.seq(LazySeq.java:51) at clojure.lang.Cons.next(Cons.java:39) at clojure.lang.RT.boundedLength(RT.java:1788) at clojure.lang.RestFn.applyTo(RestFn.java:130) at clojure.core$apply.invokeStatic(core.clj:667) at clojure.test$run_tests.invokeStatic(test.clj:768) at clojure.test$run_tests.doInvoke(test.clj:768) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.core$apply.invokeStatic(core.clj:665) at clojure.core$apply.invoke(core.clj:660) at user$eval21253$fn__21326$fn__21359.invoke(form-init11109726989949801998.clj:1) at user$eval21253$fn__21326$fn__21327.invoke(form-init11109726989949801998.clj:1) at user$eval21253$fn__21326.invoke(form-init11109726989949801998.clj:1) at user$eval21253.invokeStatic(form-init11109726989949801998.clj:1) at user$eval21253.invoke(form-init11109726989949801998.clj:1) at clojure.lang.Compiler.eval(Compiler.java:7176) at clojure.lang.Compiler.eval(Compiler.java:7166) at clojure.lang.Compiler.load(Compiler.java:7635) at clojure.lang.Compiler.loadFile(Compiler.java:7573) at clojure.main$load_script.invokeStatic(main.clj:452) at clojure.main$init_opt.invokeStatic(main.clj:454) at clojure.main$init_opt.invoke(main.clj:454) at clojure.main$initialize.invokeStatic(main.clj:485) at clojure.main$null_opt.invokeStatic(main.clj:519) at clojure.main$null_opt.invoke(main.clj:516) at clojure.main$main.invokeStatic(main.clj:598) at clojure.main$main.doInvoke(main.clj:561) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.lang.Var.applyTo(Var.java:705) at clojure.main.main(main.java:37) expected: 200 actual: 500 diff: - 200 + 500
I'm rather at a loss as to how to proceed with fixing this error. My initial guess was that it must be due to a typo somewhere but I've gone over all the files and checking it against the book and against each other and I haven't found anything that shouldn't be there.
Hi, sorry for the late reply. It looks like you're passing wrong arguments to the template based on the error. You're seeing /Users/user/Desktop/ClojStoof/guestbook/resources/html/{:messages ({:id 1, :name "Bob", :message "Hello, world!", :timestamp...
because you're likely passing the context map as the argument to the render functions where the name of the template file is expected.