Announcement Announcement Module
Collapse
No announcement yet.
problems with spring.ftl and freemarker Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • problems with spring.ftl and freemarker

    Hi! I develop on IBM WebSphere Portal Server and I have problems with spring macros library.

    If spring.ftl be in directory with other ftl-files - all OK, but I want so as to spring.ftl takes from spring.jar file

    So,

    that's my *.ftl:

    Code:
    <#ftl encoding="UTF-8">
    <#setting number_format="0.##########" />
    <#setting url_escaping_charset="ISO-8859-1" />
    
    <#import "spring.ftl" as spring>
    
    <#include "/ftl/common/page.ftl">
    <#include "/ftl/common/calendar.ftl">
    <#include "/ftl/common/bookmark.ftl">
    <#include "/freemarker/com.km.mts.glossary.view/macro_functions.ftl">
    ...
    my beans in this module:

    Code:
    ...
        <bean id="viewResolver" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
            <property name="cache"><value>true</value></property>
            <property name="prefix"><value>freemarker/com.km.mts.glossary.view/</value></property>
            <property name="suffix"><value>.ftl</value></property>
            <property name="viewClass"><value>com.km.ibmportal.spring.portlet.freemarker.FreeMarkerViewWithPortalFunctions</value></property>
            <property name="exposeSpringMacroHelpers"><value>true</value></property>
    	<property name="contentType"><value>text/html;charset=UTF-8</value></property>
        </bean>
    
        <bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
            <property name="templateLoaderPath"><value>/WEB-INF/</value></property>
            <property name="freemarkerSettings">
                <props>
                    <prop key="url_escaping_charset">UTF-8</prop>
                </props>
            </property>
        </bean>
    ...
    and my error:

    Code:
    org.springframework.context.ApplicationContextException&#58; Failed to parse FreeMarker template for URL &#91;freemarker/com.km.mts.glossary.view/terms_list_page.ftl&#93;; nested exception is freemarker.core.ParseException&#58; Unexpected end of file reached.
    Unclosed if directive.
    
    freemarker.core.ParseException&#58; Unexpected end of file reached.
    Unclosed if directive.
    
    	at freemarker.core.FMParser.generateParseException&#40;FMParser.java&#58;4411&#41;
    	at freemarker.core.FMParser.jj_consume_token&#40;FMParser.java&#58;4286&#41;
    	at freemarker.core.FMParser.If&#40;FMParser.java&#58;1084&#41;
    	at freemarker.core.FMParser.FreemarkerDirective&#40;FMParser.java&#58;2189&#41;
    	at freemarker.core.FMParser.Content&#40;FMParser.java&#58;2433&#41;
    	at freemarker.core.FMParser.OptionalBlock&#40;FMParser.java&#58;2601&#41;
    	at freemarker.core.FMParser.Root&#40;FMParser.java&#58;2773&#41;
    	at freemarker.template.Template.&#40;Template.java&#58;148&#41;
    	at freemarker.cache.TemplateCache.loadTemplate&#40;TemplateCache.java&#58;381&#41;
    	at freemarker.cache.TemplateCache.getTemplate&#40;TemplateCache.java&#58;347&#41;
    	at freemarker.cache.TemplateCache.getTemplate&#40;TemplateCache.java&#58;229&#41;
    	at freemarker.template.Configuration.getTemplate&#40;Configuration.java&#58;439&#41;
    	at freemarker.template.Configuration.getTemplate&#40;Configuration.java&#58;411&#41;
    	at org.springframework.web.servlet.view.freemarker.FreeMarkerView.getTemplate&#40;FreeMarkerView.java&#58;250&#41;
    	at org.springframework.web.servlet.view.freemarker.FreeMarkerView.getTemplate&#40;FreeMarkerView.java&#58;236&#41;
    	at org.springframework.web.servlet.view.freemarker.FreeMarkerView.checkTemplate&#40;FreeMarkerView.java&#58;158&#41;
    	at org.springframework.web.servlet.view.freemarker.FreeMarkerView.initApplicationContext&#40;FreeMarkerView.java&#58;123&#41;
    	at org.springframework.context.support.ApplicationObjectSupport.setApplicationContext&#40;ApplicationObjectSupport.java&#58;79&#41;
    	at org.springframework.web.servlet.view.UrlBasedViewResolver.loadView&#40;UrlBasedViewResolver.java&#58;303&#41;
    	at org.springframework.web.servlet.view.AbstractCachingViewResolver.createView&#40;AbstractCachingViewResolver.java&#58;139&#41;
    	at org.springframework.web.servlet.view.UrlBasedViewResolver.createView&#40;UrlBasedViewResolver.java&#58;286&#41;
    	at org.springframework.web.servlet.view.AbstractCachingViewResolver.resolveViewName&#40;AbstractCachingViewResolver.java&#58;77&#41;
    	at org.springframework.web.servlet.DispatcherServlet.resolveViewName&#40;DispatcherServlet.java&#58;950&#41;
    	at org.springframework.web.servlet.DispatcherServlet.render&#40;DispatcherServlet.java&#58;909&#41;
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch&#40;DispatcherServlet.java&#58;705&#41;
    	at org.springframework.web.servlet.DispatcherServlet.doService&#40;DispatcherServlet.java&#58;625&#41;
    	at org.springframework.web.servlet.FrameworkServlet.serviceWrapper&#40;FrameworkServlet.java&#58;386&#41;
    	at org.springframework.web.servlet.FrameworkServlet.doGet&#40;FrameworkServlet.java&#58;346&#41;
    	at javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;740&#41;
    	at javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;853&#41;
    	at com.km.ibmportal.spring.portlet.dispatcher.DispatcherServicePortlet.service&#40;DispatcherServicePortlet.java&#58;44&#41;
    	at com.km.ibmportal.spring.portlet.DispatcherPortlet.service&#40;DispatcherPortlet.java&#58;464&#41;
    ...
    
    
    ==============================
    Unexpected end of file reached.
    Unclosed if directive.
    
    ==============================
    
    freemarker.core.ParseException&#58; Unexpected end of file reached.
    Unclosed if directive.
    
    	at freemarker.core.FMParser.generateParseException&#40;FMParser.java&#58;4411&#41;
    	at freemarker.core.FMParser.jj_consume_token&#40;FMParser.java&#58;4286&#41;
    	at freemarker.core.FMParser.If&#40;FMParser.java&#58;1084&#41;
    	at freemarker.core.FMParser.FreemarkerDirective&#40;FMParser.java&#58;2189&#41;
    	at freemarker.core.FMParser.Content&#40;FMParser.java&#58;2433&#41;
    	at freemarker.core.FMParser.OptionalBlock&#40;FMParser.java&#58;2601&#41;
    	at freemarker.core.FMParser.Root&#40;FMParser.java&#58;2773&#41;
    	at freemarker.template.Template.&#40;Template.java&#58;148&#41;
    	at freemarker.cache.TemplateCache.loadTemplate&#40;TemplateCache.java&#58;381&#41;
    	at freemarker.cache.TemplateCache.getTemplate&#40;TemplateCache.java&#58;347&#41;
    	at freemarker.cache.TemplateCache.getTemplate&#40;TemplateCache.java&#58;229&#41;
    	at freemarker.template.Configuration.getTemplate&#40;Configuration.java&#58;439&#41;
    	at freemarker.template.Configuration.getTemplate&#40;Configuration.java&#58;411&#41;
    	at org.springframework.web.servlet.view.freemarker.FreeMarkerView.getTemplate&#40;FreeMarkerView.java&#58;250&#41;
    	at org.springframework.web.servlet.view.freemarker.FreeMarkerView.getTemplate&#40;FreeMarkerView.java&#58;236&#41;
    	at org.springframework.web.servlet.view.freemarker.FreeMarkerView.checkTemplate&#40;FreeMarkerView.java&#58;158&#41;
    	at org.springframework.web.servlet.view.freemarker.FreeMarkerView.initApplicationContext&#40;FreeMarkerView.java&#58;123&#41;
    	at org.springframework.context.support.ApplicationObjectSupport.setApplicationContext&#40;ApplicationObjectSupport.java&#58;79&#41;
    	at org.springframework.web.servlet.view.UrlBasedViewResolver.loadView&#40;UrlBasedViewResolver.java&#58;303&#41;
    	at org.springframework.web.servlet.view.AbstractCachingViewResolver.createView&#40;AbstractCachingViewResolver.java&#58;139&#41;
    	at org.springframework.web.servlet.view.UrlBasedViewResolver.createView&#40;UrlBasedViewResolver.java&#58;286&#41;
    	at org.springframework.web.servlet.view.AbstractCachingViewResolver.resolveViewName&#40;AbstractCachingViewResolver.java&#58;77&#41;
    	at org.springframework.web.servlet.DispatcherServlet.resolveViewName&#40;DispatcherServlet.java&#58;950&#41;
    	at org.springframework.web.servlet.DispatcherServlet.render&#40;DispatcherServlet.java&#58;909&#41;
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch&#40;DispatcherServlet.java&#58;705&#41;
    	at org.springframework.web.servlet.DispatcherServlet.doService&#40;DispatcherServlet.java&#58;625&#41;
    	at org.springframework.web.servlet.FrameworkServlet.serviceWrapper&#40;FrameworkServlet.java&#58;386&#41;
    	at org.springframework.web.servlet.FrameworkServlet.doGet&#40;FrameworkServlet.java&#58;346&#41;
    	at javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;740&#41;
    	at javax.servlet.http.HttpServlet.service&#40;HttpServlet.java&#58;853&#41;
    	at com.km.ibmportal.spring.portlet.dispatcher.DispatcherServicePortlet.service&#40;DispatcherServicePortlet.java&#58;44&#41;
    	at com.km.ibmportal.spring.portlet.DispatcherPortlet.service&#40;DispatcherPortlet.java&#58;464&#41;
    Maybe somebody know what is the matter?

  • #2
    up

    Comment


    • #3
      Hi

      I had the same exception and theproblem was some unclosed tags (in fact a / was missing). I don't know if this helps but you should double check your pages

      Comment

      Working...
      X