LCTL / spring-webmvc-rythm

Rythm Template Engine for Spring Web MVC
19 stars 6 forks source link

Template file and compiled file not found when template is rendered at first time. #16

Open dlutcat opened 10 years ago

dlutcat commented 10 years ago

When I rendered my page the first time, a error was raised:

Request processing failed; nested exception is java.lang.RuntimeException: java.io.FileNotFoundException: /usr/local/apache-tomcat-7.0.53/temp/__rythm/usr_local_apache_tomcat_7_0_53_webapps_ROOT_WEB_INF_templates_golf_courseList_html__R_T_C__.java (No such file or directory)

root cause

java.io.FileNotFoundException: /usr/local/apache-tomcat-7.0.53/temp/__rythm/usr_local_apache_tomcat_7_0_53_webapps_ROOT_WEB_INF_templates_golf_courseList_html__R_T_C__.java (No such file or directory)
    java.io.FileOutputStream.open(Native Method)
    java.io.FileOutputStream.<init>(FileOutputStream.java:221)
    java.io.FileOutputStream.<init>(FileOutputStream.java:171)
    org.rythmengine.internal.compiler.TemplateClassCache.cacheTemplateClassSource(TemplateClassCache.java:190)
    org.rythmengine.internal.compiler.TemplateClass.refresh(TemplateClass.java:590)
    org.rythmengine.internal.compiler.TemplateClass.refresh(TemplateClass.java:435)
    org.rythmengine.internal.compiler.TemplateClass.<init>(TemplateClass.java:332)
    org.rythmengine.internal.compiler.TemplateClass.<init>(TemplateClass.java:315)
    org.rythmengine.internal.compiler.TemplateClass.<init>(TemplateClass.java:307)
    org.rythmengine.RythmEngine.getTemplate(RythmEngine.java:836)
    org.rythmengine.RythmEngine.getTemplate(RythmEngine.java:871)
    org.rythmengine.RythmEngine.render(RythmEngine.java:946)
    org.rythmengine.Rythm.render(Rythm.java:265)
    com.ctlok.springframework.web.servlet.view.rythm.RythmView.renderMergedTemplateModel(RythmView.java:28)
    org.springframework.web.servlet.view.AbstractTemplateView.renderMergedOutputModel(AbstractTemplateView.java:167)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:264)
    org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1208)
    org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:992)
    org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:939)
    org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
    org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:915)
    org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:811)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
    org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:796)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
    org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)
    org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:155)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
    org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)
    org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)
    org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)
    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
    org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
    org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
    org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    org.jasig.cas.client.session.SingleSignOutFilter.doFilter(SingleSignOutFilter.java:76)

When I refreshed the page, another error raised:

java.lang.RuntimeException: Error load template instance for /usr/local/apache-tomcat-7.0.53/webapps/ROOT/WEB-INF/templates/golf/courseList.html
    org.rythmengine.internal.compiler.TemplateClass.templateInstance_(TemplateClass.java:379)
    org.rythmengine.internal.compiler.TemplateClass.asTemplate(TemplateClass.java:396)
    org.rythmengine.internal.compiler.TemplateClass.asTemplate(TemplateClass.java:402)
    org.rythmengine.RythmEngine.getTemplate(RythmEngine.java:839)
    org.rythmengine.RythmEngine.getTemplate(RythmEngine.java:871)
    org.rythmengine.RythmEngine.render(RythmEngine.java:946)
    org.rythmengine.Rythm.render(Rythm.java:265)
    com.ctlok.springframework.web.servlet.view.rythm.RythmView.renderMergedTemplateModel(RythmView.java:28)
    org.springframework.web.servlet.view.AbstractTemplateView.renderMergedOutputModel(AbstractTemplateView.java:167)
    org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:264)

The third time, the page rendered successfully. So, what is the possible reason?

LCTL commented 10 years ago

Which version of Rythm template engine are you using ?