Re: FileNotFoundException on existing template
Daniel Dekany <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
Thursday, May 31, 2012, 9:46:51 AM, mira wrote: > Hi, I posted this question on the FreeMarker page Where exactly? > but got no answer so > re-posting here in case no one saw my post. If you have, sorry for the > repetition > > We are using freemarker 2.3.16 with Spring MVC > > After our website is up for a while (around one week), it stops working and > our log files are filled with a FileNotFoundException on one of the > templates; except this template is being used on all pages, meaning it is > not missing. We thought it may be a garbage collection issue on the cache > issue so using the spring configurer for freemarker we set the cache to > Strong: > > <bean id="freemarkerConfig" > class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer"> > <property name="templateLoaderPath" value="/WEB-INF/views/"/> > <property name="freemarkerSettings"> > <props> > <prop key="url_escaping_charset">UTF-8</prop> > <prop key="cache_storage">strong</prop> > </props> > </property> > </bean> > > However, the exception still appeared. Do you have any idea why this may be > happening and how to solve? I have seen people complaining about these (or just similar?) mystical FileNotFoundErrors, but it has never turned out what was the cause. Running out of file handles is a guess (even with a strong cache and never changing templates, up-to-date checks might need them, or something can flush the cache explicitly). However, that should leave a *few* specific IOError-s in the log, along with these generic ones that you show (which can be the result of an earlier cached failure). Also then they should usually go away after the template update delay has passed. Anyway, I would like to see this solved. So, how about me creating a special FreeMarker 2.3.16 jar, which logs details about what's going on whenever there's a problem with "syndi-macros.ftl"? Will you be allowed to use that on the production server? Also, it would be good to know what TemplateLoader are you using. > the following is a sample of the exception found: > > > Error reading imported file syndi-macros.ftl The problematic instruction: ---------- ==>> import "syndi-macros.ftl" as syndi [on line 2, column 1 in > index.ftl] ---------- Java backtrace for programmers: ---------- > freemarker.template.TemplateException: Error reading imported file > syndi-macros.ftl at > freemarker.core.LibraryLoad.accept(LibraryLoad.java:122) > at > freemarker.core.Environment.visit(Environment.java:210) at > freemarker.core.MixedContent.accept(MixedContent.java:92) at > freemarker.core.Environment.visit(Environment.java:210) at > freemarker.core.Environment.process(Environment.java:190) at > freemarker.template.Template.process(Template.java:237) at > org.springframework.web.servlet.view.freemarker.FreeMarkerView.processTemplate(FreeMarkerView.java:366) > at > org.springframework.web.servlet.view.freemarker.FreeMarkerView.doRender(FreeMarkerView.java:283) > at > org.springframework.web.servlet.view.freemarker.FreeMarkerView.renderMergedTemplateModel(FreeMarkerView.java:233) > at > org.springframework.web.servlet.view.AbstractTemplateView.renderMergedOutputModel(AbstractTemplateView.java:167) > at > org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250) > at > org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1047) > at > org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:817) > at > org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719) > at > org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644) > at > org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549) > at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at > javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at > org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:538) at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1352) > at > org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:77) > at > org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:133) at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323) > at > com.knowledgeview.util.web.DateFilter.doFilterInternal(DateFilter.java:17) > at > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) > at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323) > at > org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) > at > org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) > at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368) > at > org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109) > at > org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) > at > org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) > at > org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) > at > org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) > at > org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:112) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) > at > org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) > at > org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) > at > org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) > at > org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter.doFilter(DefaultLoginPageGeneratingFilter.java:91) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) > at > org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) > at > org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) > at > org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79) > at > org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) > at > org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169) > at > org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237) > at > org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) > at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323) > at > com.knowledgeview.util.web.SessionIdFilter.doFilter(SessionIdFilter.java:51) > at > org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323) > at > org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:474) > at > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119) > at > org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:517) > at > org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:225) > at > org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:934) > at > org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:404) > at > org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183) > at > org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:869) > at > org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117) > at > org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:47) > at > org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:151) > at > org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:114) > at org.eclipse.jetty.server.Server.handle(Server.java:341) at > org.eclipse.jetty.server.HttpConnection.handleRequest(HttpConnection.java:589) > at > org.eclipse.jetty.server.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:1048) > at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:601) at > org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:214) at > org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:411) at > org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:515) > at > org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40) > at > org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529) > at java.lang.Thread.run(Thread.java:662) Caused by: > java.io.FileNotFoundException: Template syndi-macros.ftl not found. at > freemarker.template.Configuration.getTemplate(Configuration.java:489) at > freemarker.core.Environment.getTemplateForInclusion(Environment.java:1465) > at > freemarker.core.Environment.getTemplateForImporting(Environment.java:1519) > at > freemarker.core.LibraryLoad.accept(LibraryLoad.java:112) ... 82 more > > -- > View this message in context: > http://freemarker.624813.n4.nabble.com/FileNotFoundException-on-existing-template-tp4654081.html > Sent from the freemarker-user mailing list archive at Nabble.com. -- Best regards, Daniel Dekany ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/