Java Intro to Java Web Development with Spark Bells and Whistles Accessing Specific Items

Keep getting error with handlebars

Cannot reach /ideas, keep getting 500 Internal Server Error

Code here -> https://github.com/Jourio/JavaWebDevelopment/tree/master/SparkVoteApp

Error whenever trying to reach /ideas:

/usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java -javaagent:/home/roope/Documents/idea-IC-172.4343.14/lib/idea_rt.jar=33207:/home/roope/Documents/idea-IC-172.4343.14/bin -Dfile.encoding=UTF-8 -classpath /usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/charsets.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/cldrdata.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/dnsns.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/icedtea-sound.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/jaccess.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/java-atk-wrapper.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/localedata.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/nashorn.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/sunec.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/sunjce_provider.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/sunpkcs11.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/ext/zipfs.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/jce.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/jsse.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/management-agent.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/resources.jar:/usr/lib/jvm/java-1.8.0-openjdk-amd64/jre/lib/rt.jar:/home/roope/Documents/ohjelmat/java/WebDev/SparkVoteApp/out/production/classes:/home/roope/Documents/ohjelmat/java/WebDev/SparkVoteApp/out/production/resources:/root/.gradle/caches/modules-2/files-2.1/com.sparkjava/spark-core/2.7.0/49d098a9fa58b4e2f03fba5cc2648a98e98ea1f0/spark-core-2.7.0.jar:/root/.gradle/caches/modules-2/files-2.1/com.sparkjava/spark-template-handlebars/2.3/c545ed1f27dad7d3df0ba7e5252d3a3a4fb546fc/spark-template-handlebars-2.3.jar:/root/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-simple/1.7.21/be4b3c560a37e69b6c58278116740db28832232c/slf4j-simple-1.7.21.jar:/root/.gradle/caches/modules-2/files-2.1/com.github.slugify/slugify/2.1.12/a921e975ac2da9cbb4618a0448b697fd1adba054/slugify-2.1.12.jar:/root/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty/jetty-server/9.4.6.v20170531/afda653f00267fb8b501cafd1cf5cdd1615602a2/jetty-server-9.4.6.v20170531.jar:/root/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty/jetty-webapp/9.4.6.v20170531/3e64618f88061ecd5538e6092f44e7410609e41c/jetty-webapp-9.4.6.v20170531.jar:/root/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty.websocket/websocket-server/9.4.6.v20170531/3df260d52e941345ad40498bb23307ec3e9c2683/websocket-server-9.4.6.v20170531.jar:/root/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty.websocket/websocket-servlet/9.4.6.v20170531/6f4f1a91e61cc15060ea0beecc7a5d035c1d65f6/websocket-servlet-9.4.6.v20170531.jar:/root/.gradle/caches/modules-2/files-2.1/com.github.jknack/handlebars/1.3.1/24bdd1b9b2a9893eac594dd78b059fc62ff85743/handlebars-1.3.1.jar:/root/.gradle/caches/modules-2/files-2.1/com.github.jknack/handlebars-guava-cache/1.3.1/68e15e29458a4194cf783893cdf10c03998a99bc/handlebars-guava-cache-1.3.1.jar:/root/.gradle/caches/modules-2/files-2.1/com.ibm.icu/icu4j/59.1/6f06e820cf4c8968bbbaae66ae0b33f6a256b57f/icu4j-59.1.jar:/root/.gradle/caches/modules-2/files-2.1/org.apache.commons/commons-lang3/3.1/905075e6c80f206bbe6cf1e809d2caa69f420c76/commons-lang3-3.1.jar:/root/.gradle/caches/modules-2/files-2.1/org.antlr/antlr4-runtime/4.2.2/23f7a0544b36189d688de27688ebd3111f456c97/antlr4-runtime-4.2.2.jar:/root/.gradle/caches/modules-2/files-2.1/org.mozilla/rhino/1.7R4/e982f2136574b9a423186fbaeaaa98dc3e5a5288/rhino-1.7R4.jar:/root/.gradle/caches/modules-2/files-2.1/com.google.guava/guava/14.0.1/69e12f4c6aeac392555f1ea86fab82b5e5e31ad4/guava-14.0.1.jar:/root/.gradle/caches/modules-2/files-2.1/org.antlr/antlr4-annotations/4.2.2/ab9b4d205530b2b225987c1740f8d71103835aa4/antlr4-annotations-4.2.2.jar:/root/.gradle/caches/modules-2/files-2.1/javax.servlet/javax.servlet-api/3.1.0/3cd63d075497751784b2fa84be59432f4905bf7c/javax.servlet-api-3.1.0.jar:/root/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty/jetty-http/9.4.6.v20170531/6c2dd034fc4128ea65f2d0199473cbfb80aeb428/jetty-http-9.4.6.v20170531.jar:/root/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty/jetty-io/9.4.6.v20170531/69cdaaac75739eff9ccb4c61f87e4fa3ba280f9/jetty-io-9.4.6.v20170531.jar:/root/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty/jetty-xml/9.4.6.v20170531/25818a656163364b89966fbfdc6f43a8d8b65d2a/jetty-xml-9.4.6.v20170531.jar:/root/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty/jetty-servlet/9.4.6.v20170531/7d302b454433ee1b9799761c23d0323542f2525b/jetty-servlet-9.4.6.v20170531.jar:/root/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty.websocket/websocket-common/9.4.6.v20170531/32ddd92bdb1b9351369b32d770667706c1a7fb67/websocket-common-9.4.6.v20170531.jar:/root/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty.websocket/websocket-client/9.4.6.v20170531/7abf96c2a2afa5966fea35375fc0280e1365b8eb/websocket-client-9.4.6.v20170531.jar:/root/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty.websocket/websocket-api/9.4.6.v20170531/67e88613850da0aa0874e9b6bc2d7dd812968346/websocket-api-9.4.6.v20170531.jar:/root/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty/jetty-util/9.4.6.v20170531/78628ec5cfafbb5b8085342322515c65fadfa1cc/jetty-util-9.4.6.v20170531.jar:/root/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty/jetty-security/9.4.6.v20170531/6c4cdac99130d887abc6fa6645adcd033f763d02/jetty-security-9.4.6.v20170531.jar:/root/.gradle/caches/modules-2/files-2.1/org.eclipse.jetty/jetty-client/9.4.6.v20170531/ec4139632f338738124e1d77824e3b73be1c6f5f/jetty-client-9.4.6.v20170531.jar:/root/.gradle/caches/modules-2/files-2.1/org.slf4j/slf4j-api/1.7.21/139535a69a4239db087de9bab0bee568bf8e0b70/slf4j-api-1.7.21.jar com.jourio.roope.Main
[main] INFO spark.staticfiles.StaticFilesConfiguration - StaticResourceHandler configured with folder = /public
[Thread-0] INFO org.eclipse.jetty.util.log - Logging initialized @138ms to org.eclipse.jetty.util.log.Slf4jLog
[Thread-0] INFO spark.embeddedserver.jetty.EmbeddedJettyServer - == Spark has ignited ...
[Thread-0] INFO spark.embeddedserver.jetty.EmbeddedJettyServer - >> Listening on 0.0.0.0:4567
[Thread-0] INFO org.eclipse.jetty.server.Server - jetty-9.4.6.v20170531
[Thread-0] INFO org.eclipse.jetty.server.session - DefaultSessionIdManager workerName=node0
[Thread-0] INFO org.eclipse.jetty.server.session - No SessionScavenger set, using defaults
[Thread-0] INFO org.eclipse.jetty.server.session - Scavenging every 660000ms
[Thread-0] INFO org.eclipse.jetty.server.AbstractConnector - Started ServerConnector@230cb7db{HTTP/1.1,[http/1.1]}{0.0.0.0:4567}
[Thread-0] INFO org.eclipse.jetty.server.Server - Started @223ms
[qtp1978093083-13] ERROR spark.http.matching.GeneralError - 
com.google.common.util.concurrent.UncheckedExecutionException: com.github.jknack.handlebars.HandlebarsException: /templates/ideas.hbs:8:46: found: ' '
                    {{ title }} ( {{ voteCount }} votes) <button>Vote</button>
                                              ^

    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2263)
    at com.google.common.cache.LocalCache.get(LocalCache.java:4000)
    at com.google.common.cache.LocalCache$LocalManualCache.get(LocalCache.java:4789)
    at com.github.jknack.handlebars.cache.GuavaTemplateCache.get(GuavaTemplateCache.java:69)
    at com.github.jknack.handlebars.Handlebars.compile(Handlebars.java:431)
    at com.github.jknack.handlebars.Handlebars.compile(Handlebars.java:374)
    at com.github.jknack.handlebars.Handlebars.compile(Handlebars.java:360)
    at spark.template.handlebars.HandlebarsTemplateEngine.render(HandlebarsTemplateEngine.java:75)
    at spark.TemplateViewRouteImpl$1.render(TemplateViewRouteImpl.java:61)
    at spark.TemplateViewRouteImpl$1.render(TemplateViewRouteImpl.java:58)
    at spark.TemplateViewRouteImpl.render(TemplateViewRouteImpl.java:86)
    at spark.http.matching.Routes.execute(Routes.java:63)
    at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:130)
    at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1568)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.Server.handle(Server.java:564)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:317)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110)
    at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
    at org.eclipse.jetty.util.thread.Invocable.invokePreferred(Invocable.java:128)
    at org.eclipse.jetty.util.thread.Invocable$InvocableExecutor.invoke(Invocable.java:222)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:294)
    at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:126)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:673)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:591)
    at java.lang.Thread.run(Thread.java:748)
Caused by: com.github.jknack.handlebars.HandlebarsException: /templates/ideas.hbs:8:46: found: ' '
                    {{ title }} ( {{ voteCount }} votes) <button>Vote</button>
                                              ^

    at com.github.jknack.handlebars.internal.HbsErrorReporter.syntaxError(HbsErrorReporter.java:93)
    at org.antlr.v4.runtime.ProxyErrorListener.syntaxError(ProxyErrorListener.java:67)
    at com.github.jknack.handlebars.internal.HbsParserFactory$2.notifyListeners(HbsParserFactory.java:148)
    at org.antlr.v4.runtime.Lexer.nextToken(Lexer.java:168)
    at org.antlr.v4.runtime.BufferedTokenStream.fetch(BufferedTokenStream.java:187)
    at org.antlr.v4.runtime.BufferedTokenStream.sync(BufferedTokenStream.java:170)
    at org.antlr.v4.runtime.BufferedTokenStream.consume(BufferedTokenStream.java:154)
    at org.antlr.v4.runtime.Parser.consume(Parser.java:586)
    at org.antlr.v4.runtime.Parser.match(Parser.java:218)
    at com.github.jknack.handlebars.internal.HbsParser.sexpr(HbsParser.java:609)
    at com.github.jknack.handlebars.internal.HbsParser.var(HbsParser.java:904)
    at com.github.jknack.handlebars.internal.HbsParser.statement(HbsParser.java:271)
    at com.github.jknack.handlebars.internal.HbsParser.body(HbsParser.java:161)
    at com.github.jknack.handlebars.internal.HbsParser.block(HbsParser.java:543)
    at com.github.jknack.handlebars.internal.HbsParser.statement(HbsParser.java:265)
    at com.github.jknack.handlebars.internal.HbsParser.body(HbsParser.java:161)
    at com.github.jknack.handlebars.internal.HbsParser.block(HbsParser.java:543)
    at com.github.jknack.handlebars.internal.HbsParser.statement(HbsParser.java:265)
    at com.github.jknack.handlebars.internal.HbsParser.body(HbsParser.java:161)
    at com.github.jknack.handlebars.internal.HbsParser.template(HbsParser.java:106)
    at com.github.jknack.handlebars.internal.HbsParserFactory$1.parse(HbsParserFactory.java:84)
    at com.github.jknack.handlebars.cache.GuavaTemplateCache$1.call(GuavaTemplateCache.java:72)
    at com.github.jknack.handlebars.cache.GuavaTemplateCache$1.call(GuavaTemplateCache.java:69)
    at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4792)
    at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3599)
    at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2379)
    at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2342)
    at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2257)
    ... 29 more

2 Answers

I figured out what's wrong, there was one extra space after {{ title }}, what a stupid small typo lol.

Bump please