Skip to content
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

Issue with rendering home.html, Ch. 1, Pg 15 #25

Open
ghost opened this issue Mar 24, 2019 · 1 comment
Open

Issue with rendering home.html, Ch. 1, Pg 15 #25

ghost opened this issue Mar 24, 2019 · 1 comment

Comments

@ghost
Copy link

ghost commented Mar 24, 2019

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.(FileInputStream.java:157)
at clojure.java.io$fn__11470.invokeStatic(io.clj:238)
at clojure.java.io$fn__11470.invoke(io.clj:235)
at clojure.java.io$fn__11379$G__11372__11386.invoke(io.clj:69)
at clojure.java.io$fn__11440.invokeStatic(io.clj:165)
at clojure.java.io$fn__11440.invoke(io.clj:165)
at clojure.java.io$fn__11392$G__11368__11399.invoke(io.clj:69)
at clojure.java.io$reader.invokeStatic(io.clj:102)
at clojure.java.io$reader.doInvoke(io.clj:86)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at selmer.validator$validate_tags.invokeStatic(validator.clj:103)
at selmer.validator$validate_tags.invoke(validator.clj:102)
at selmer.validator$validate.invokeStatic(validator.clj:116)
at selmer.validator$validate.invoke(validator.clj:113)
at selmer.template_parser$read_template.invokeStatic(template_parser.clj:197)
at selmer.template_parser$read_template.invoke(template_parser.clj:191)
at selmer.template_parser$preprocess_template.invokeStatic(template_parser.clj:253)
at selmer.template_parser$preprocess_template.doInvoke(template_parser.clj:252)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at selmer.parser$parse_file.invokeStatic(parser.clj:269)
at selmer.parser$parse_file.invoke(parser.clj:268)
at selmer.parser$parse.invokeStatic(parser.clj:297)
at selmer.parser$parse.doInvoke(parser.clj:271)
at clojure.lang.RestFn.invoke(RestFn.java:442)
at selmer.parser$render_file.invokeStatic(parser.clj:134)
at selmer.parser$render_file.doInvoke(parser.clj:116)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at guestbook.layout$render.invokeStatic(layout.clj:19)
at guestbook.layout$render.doInvoke(layout.clj:14)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at guestbook.routes.home$home_page.invokeStatic(home.clj:10)
at guestbook.routes.home$home_page.invoke(home.clj:9)
at muuntaja.middleware$wrap_params$fn__7336.invoke(middleware.clj:52)
at muuntaja.middleware$wrap_format$fn__7340.invoke(middleware.clj:73)
at guestbook.middleware$wrap_formats$fn__11348.invoke(middleware.clj:42)
at ring.middleware.anti_forgery$wrap_anti_forgery$fn__6180.invoke(anti_forgery.clj:94)
at reitit.ring$ring_handler$fn__18263.invoke(ring.cljc:288)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.lang.AFunction$1.doInvoke(AFunction.java:31)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at ring.middleware.reload$wrap_reload$fn__4503.invoke(reload.clj:39)
at selmer.middleware$wrap_error_page$fn__4516.invoke(middleware.clj:9)
at prone.middleware$wrap_exceptions$fn__4774.invoke(middleware.clj:159)
at ring.middleware.flash$wrap_flash$fn__7375.invoke(flash.clj:39)
at ring.middleware.session$wrap_session$fn__10822.invoke(session.clj:108)
at immutant.web.internal.undertow$wrap_undertow_session$fn__19439.invoke(undertow.clj:83)
at ring.middleware.keyword_params$wrap_keyword_params$fn__10868.invoke(keyword_params.clj:53)
at ring.middleware.nested_params$wrap_nested_params$fn__10926.invoke(nested_params.clj:89)
at ring.middleware.multipart_params$wrap_multipart_params$fn__11058.invoke(multipart_params.clj:173)
at ring.middleware.params$wrap_params$fn__11082.invoke(params.clj:67)
at ring.middleware.cookies$wrap_cookies$fn__10701.invoke(cookies.clj:175)
lein test :only guestbook.test.handler/test-app

    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.

@yogthos
Copy link
Member

yogthos commented Apr 9, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant