FreeMarker template error: The following has evaluated to null or missing | BUT NOT TRUE

freemarker null check
freemarker template error null or missing
freemarker core invalidreferenceexception exception message was already printed; see it above
errors due to missing freemarker symbol
if the failing expression is known to legally refer to something that's sometimes null or missing
freemarker error handling
freemarker null check if
freemarker null or empty string

The error I'm facing is so weird. Everything looks fine, but I get this error when the browser sends the GET request to the server. What I'm trying to do is actually catching the HTTP parameters, save them in an object saved in an ArrayList sending to a Freemarker template.

Could you please help me? Thanks a lot.

The error:

freemarker.log._JULLoggerFactory$JULLogger error SEVERE: Error executing FreeMarker template FreeMarker template error: The following has evaluated to null or missing: ==> item.lat1 [in template "view/result.ftl" at line 18, column 15]

freemarker.core.InvalidReferenceException: [... Exception message was already printed; see it above ...] at freemarker.core.InvalidReferenceException.getInstance( at freemarker.core.EvalUtil.coerceModelToString( at freemarker.core.Expression.evalAndCoerceToString( at freemarker.core.DollarVariable.accept( at freemarker.core.Environment.visit( at freemarker.core.MixedContent.accept( at freemarker.core.Environment.visitByHiddingParent( at freemarker.core.IteratorBlock$IterationContext.executeNestedBlockInner( at freemarker.core.IteratorBlock$IterationContext.executeNestedBlock( at freemarker.core.IteratorBlock$IterationContext.accept( at freemarker.core.Environment.visitIteratorBlock( at freemarker.core.IteratorBlock.acceptWithResult( at freemarker.core.IteratorBlock.accept( at freemarker.core.Environment.visit( at freemarker.core.MixedContent.accept( at freemarker.core.Environment.visit( at freemarker.core.Environment.process( at freemarker.template.Template.process( at spark.template.freemarker.FreeMarkerEngine.render( at controller.App.lambda$main$1( at spark.RouteImpl$1.handle( at spark.webserver.MatcherFilter.doFilter( at spark.webserver.JettyHandler.doHandle( at org.eclipse.jetty.server.session.SessionHandler.doScope( at org.eclipse.jetty.server.handler.ScopedHandler.handle( at org.eclipse.jetty.server.handler.HandlerWrapper.handle( at org.eclipse.jetty.server.Server.handle( at org.eclipse.jetty.server.HttpChannel.handle( at org.eclipse.jetty.server.HttpConnection.onFillable( at$ReadCallback.succeeded( at at$ at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun( at at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob( at org.eclipse.jetty.util.thread.QueuedThreadPool$ at

[qtp285763673-17] ERROR spark.webserver.MatcherFilter - java.lang.IllegalArgumentException: freemarker.core.InvalidReferenceException: The following has evaluated to null or missing: ==> item.lat1 [in template "view/result.ftl" at line 18, column 15]

.. But true, because I do print the Array and it works fine!

  final FreeMarkerEngine freeMarkerEngine = new FreeMarkerEngine();
    final Configuration freeMarkerConfiguration = new Configuration();
    freeMarkerConfiguration.setTemplateLoader(new ClassTemplateLoader(App.class, "/"));

    get("/rest", (request, response) -> {
        Double lat1 = Double.parseDouble(request.queryParams("lat1") != null ? request.queryParams("lat1") : "anonymous");
        Double lon1 = Double.parseDouble(request.queryParams("lon1") != null ? request.queryParams("lon1") : "anonymous");
        Double lat2 = Double.parseDouble(request.queryParams("lat2") != null ? request.queryParams("lat2") : "anonymous");
        Double lon2 = Double.parseDouble(request.queryParams("lon2") != null ? request.queryParams("lon2") : "anonymous");

        if (shouldReturnHtml(request)) {
            Map<String, Object> attributes = new HashMap<>();
            return freeMarkerEngine.render(new ModelAndView(attributes, "/view/result.ftl"));
        else {
            return null;


private static boolean shouldReturnHtml(Request request) {
    String accept = request.headers("Accept");
    return accept != null && accept.contains("text/html");
public static ArrayList<Bereken> loadTheList(double lat1, double lon1, double lat2, double lon2) {
    ArrayList<Bereken> list = new ArrayList<>();
    list.add(new Bereken(lat1,lon1,lat2,lon2));
    return list;

And result.ftl:

      <#list list as item>

You are adding 1 instance of the Bereken class to the "list". So i would assume the Bereken class does not provide public properties lat1, lat2, lon1, lon2 or coresponding getter methods.

5.1 FreeMarker template error: The following has e, 5.1 FreeMarker template error: The following has evaluated to null or missing System has been fine since the multi tenancy was enabled - ie:no errors logged operator to fallback to an empty string if there is no data - but it is You can correct it by editing the template document specified by the NodeRef�

I know this is an old question, but I just bumped into this. Freemarker will also complain that the value "is null or missing" if you pass it an instance of a private class (which I just tried). If you pass in a Java Bean class, it needs to be public. The error message is very misleading in this case.

Error handling, FreeMarker template error: The following has evaluated to null or missing #118. Closed. uniqueid001 opened this issue on Aug 28, 2015 � 2 comments. Closed�

I just ran across this yesterday. I was working through a tutorial and one of the steps did not include the code for a getter method in a class that created an object. I guess the author just assumed the reader knew that should have happened already.

So, wherever this 'Bereken' thing is (I just learned it is a JavaBean class), be sure to add the setter and getter methods for the properties associated with each element in the 'list'.

The following has evaluated to null or missing: in template , FreeMarker template error: The following has evaluated to null or missing well, but when adding the template, the frequent null pointer problem. refer to something that's sometimes null or missing, either specify a default value of null pointers in the front --> <prop key="classic_compatible">true</prop>�

Document type properties evaluating to null or missing in template , FreeMarker has to load the template into the memory and parse it (unless HTML_DEBUG_HANDLER : Same as DEBUG_HANDLER , but it If an error occurs in an interpolation which is not inside an FTL tag (that is, not enclosed into <#. Handling missing/null variables: Template Author's Guide/The�

java, Not Logged In. Log in. WW-5051. The following has evaluated to null or missing: in template But in Ubuntu OS, its giving issues. ( error:59) Error executing FreeMarker template FreeMarker�

关于java:FreeMarker模板错误:以下内容评估为null或缺少| 但是不是 , InvalidReferenceException: The following has evaluated to null or missing” error. doesn't have a null check, but does exist in my document, is “null or missing”. WARN [HstFreemarkerServlet] Error in Freemarker template: [INFO] It's the step after the last dot that caused this error, not those before it.