2016-06-29 5 views
0

spark에 문제가 있습니다. "base.hbs"보기를로드하려고하는데 불꽃을로드하려고 할 때마다 Spark에서 FileNotFoundException을 throw합니다.FileNotFoundException Sparkjava에서 HandlebarsTemplateEngine 사용

새 HandlebarsTemplateEngine ("try/different/paths/here"); 운이 없다. 나는 심지어 C :/Drive에 리소스 폴더를 두어 보았지만 외부 적으로는 아무런 운이 없었습니다 ...

일반 임베디드 Jetty Server를 사용하고 있지 않지만 Tomcat 서버를 사용하고 있습니다. 다른 get 메소드가 작동하는 곳 (문자열을 반환하는 곳)

감사합니다.

코드 :

@Override 
public void init() { 

    Map map = new HashMap(); 
    map.put("name", "Sam Cooke"); 

    get("/hello", (rq, rs) -> { 
     System.out.println(rq.contextPath()); 

     return new ModelAndView(map, "base.hbs");}, new HandlebarsTemplateEngine("resources/templates/")); 

    exception(Exception.class, (ex, rq, rs)->{ex.printStackTrace();}); 
} 

폴더 구조 :

File Structure

예외 :

org.eclipse.jetty.io.RuntimeIOException: java.io.FileNotFoundException: resources/templates/base.hbs 
at spark.template.handlebars.HandlebarsTemplateEngine.render(HandlebarsTemplateEngine.java:78) 
at spark.TemplateViewRouteImpl$1.render(TemplateViewRouteImpl.java:61) 
at spark.TemplateViewRouteImpl$1.render(TemplateViewRouteImpl.java:58) 
at spark.TemplateViewRouteImpl.render(TemplateViewRouteImpl.java:85) 
at spark.http.matching.Routes.execute(Routes.java:62) 
at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:126) 
at spark.servlet.SparkFilter.doFilter(SparkFilter.java:119) 
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) 
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) 
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) 
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) 
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) 
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) 
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) 
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616) 
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) 
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:521) 
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1096) 
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:674) 
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500) 
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456) 
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) 
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) 
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) 
at java.lang.Thread.run(Unknown Source) 


Caused by: java.io.FileNotFoundException: resources/templates/base.hbs 
at com.github.jknack.handlebars.io.URLTemplateLoader.sourceAt(URLTemplateLoader.java:70) 
at com.github.jknack.handlebars.Handlebars.compile(Handlebars.java:391) 
at com.github.jknack.handlebars.Handlebars.compile(Handlebars.java:377) 
at spark.template.handlebars.HandlebarsTemplateEngine.render(HandlebarsTemplateEngine.java:75) 
... 24 more 

답변

0

그것은 대답은 이클립스를 다시 시작하는 것이라고 밝혀 ... 예수님이 있었다 재시작으로 해결 된 버그의 하루 ... 감사 클립 ...