Re: FileNotFoundException on existing template
mira <[email protected]>
| Newsgroups | gmane.comp.web.freemarker.user |
|---|---|
| Message-ID | <[email protected]> |
> > Hi, I posted this question on the FreeMarker page > > Where exactly? > At http://freemarker.624813.n4.nabble.com/FileNotFoundException-on-existing-template-td4654080.html (not the user forum) > > 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. Regarding this, I found the following that might be relevant: http://www.coderanch.com/t/423917/Linux-UNIX/Java-app-server-intermittently-throws The last comment mentions it may be a concurrency issue, so they disable caching. A look at the docs supports this as MRUCacheStorage is NOT thread-safe and my above setting to strong does not use StrongCacheStorage but rather an MRUCacheStorage with unlimited map size. However, docs state that StrongCacheStorage is thread-safe on Java 5 and above so we are going to use that. If it re-occurs we will revisit this. > > 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? I would have to check regarding this point. So if yes, will get back to you on this. > > Also, it would be good to know what TemplateLoader are you using. We do not specify, so basically the default TemplateLoader by freemarker with the given path as specified by the docs at http://static.springsource.org/spring/docs/1.1.4/api/org/springframework/ui/freemarker/FreeMarkerConfigurationFactory.html#setTemplateLoaderPath(java.lang.String) -- View this message in context: http://freemarker.624813.n4.nabble.com/FileNotFoundException-on-existing-template-tp4654081p4654083.html Sent from the freemarker-user mailing list archive at Nabble.com. ------------------------------------------------------------------------------ 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/