title: spring app not finding property on object
body: <p>I have an object <code>calendar</code> of type <code>AppointmentCalendar</code>.  In a jsp called <code>calendar.jsp</code>, I call one of <code>calendar</code>'s properties as <code>calendar.day</code>.  But I am getting an error saying:  </p>
  
  <pre><code>org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 9): Field or property 'day' cannot be found on object of type  
  </code></pre>
  
  <p>Can anyone show me how to resolve this?  </p>
  
  <p>Here is the part of <code>calendar.jsp</code> which refers to the <code>day</code> property:  </p>
  
  <pre><code>&lt;%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %&gt;
  &lt;%@ taglib uri="http://www.springframework.org/tags" prefix="spring" %&gt;
  &lt;%@ taglib prefix="joda" uri="http://www.joda.org/joda/time/tags" %&gt;
  &lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt;
  &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
  &lt;html&gt;
  &lt;head&gt;
      &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt;
      &lt;title&gt;Insert title here&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
      &lt;div id="appointmentDay" class="prepend-6 span-4 alt"&gt;
          &lt;spring:eval expression="calendar.day" /&gt;
      &lt;/div&gt;
      &lt;div id="appointmentNavigation" class="span-3 append-11 last alt"&gt;
          &lt;c:url var="previousLink" value="/calendar"&gt;
              &lt;c:param name="day" value="${calendar.previousDay}" /&gt;
          &lt;/c:url&gt;
          &lt;a href="${previousLink}"&gt;Previous&lt;/a&gt;
          &lt;c:url var="nextLink" value="/calendar"&gt;
              &lt;c:param name="day" value="${calendar.nextDay}" /&gt;
          &lt;/c:url&gt;
          &lt;a href="${nextLink}"&gt;Next&lt;/a&gt;  
      &lt;/div&gt;
      &lt;div id="dayPicker" class="span-6"&gt;&lt;/div&gt;
      ... other irrelevant code
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Here is the part of <code>EncounterController</code> which manages the <code>/calendar</code> url pattern:  </p>
  
  <pre><code>@RequestMapping("/calendar")
  public String showCalendar(Model model) {
      LocalDate today = new LocalDate();
      System.out.println("------------------------ in controller, day of month is:  "+today.getDayOfMonth());
      AppointmentCalendar calendar = new AppointmentCalendar(today); // Or whatever you do to create it
      model.addAttribute("calendar", calendar);
      return "appointments/calendar";
  }
  </code></pre>
  
  <p>Here is AppointmentCalendar :  </p>
  
  <pre><code>import java.util.ArrayList;
  import java.util.Date;
  import java.util.List;
  import org.joda.time.LocalDate;
  import org.joda.time.LocalTime;
  import org.springframework.format.annotation.DateTimeFormat;
  
  public class AppointmentCalendar {
      @DateTimeFormat(style="F-")
      private LocalDate day;
  
      private List&lt;Provider&gt; providers;
  
      private List&lt;Encounter&gt; encounters; 
  
      public AppointmentCalendar(LocalDate day) {
          this.day = day;
          System.out.println(":::::::::::::::::::::::::: in AppointmentCalendar constructor, dayOfMonth is: "+day.getDayOfMonth());
      }
  
      public void setProviders(List&lt;Provider&gt; doctors) {
          this.providers = doctors;
          encounters = new ArrayList&lt;Encounter&gt;();
          for (int i = 0; i &lt; 9; i++) {encounters.add(null);}
      }
  
      public void addEncounter(Encounter appointment) {
          int blockIndex = appointment.getDateTime().getHourOfDay() - 8;
          encounters.add(appointment);
      }
  
      public Long getDayMillis() {
          return day.toDateTimeAtStartOfDay().getMillis();
      }
  
      public List&lt;LocalTime&gt; getBlocks() {
          List&lt;LocalTime&gt; blocks = new ArrayList&lt;LocalTime&gt;(9);
          LocalTime time = new LocalTime(8, 0);
          for (int i = 0; i &lt; 9; i++) {
              blocks.add(time);
              time = time.plusMinutes(60);
          }
          return blocks;
      }
  
      public Long getBlockMillis(LocalTime block) {return day.toDateTime(block).getMillis();}
  
      public Date getStartOfDay() {return day.toDateTime(getBlocks().get(0)).toDate();}
  
      public Date getEndOfDay() {return day.toDateTime(getBlocks().get(8)).plusMillis(60).toDate();}
  
      // resource links
  
      public LocalDate getPreviousDay() {return day.minusDays(1);}
  
      public LocalDate getNextDay() {return day.plusDays(1);}
  
      // internal
  
      private List&lt;Encounter&gt; createEncounterList(int size) {
          List&lt;Encounter&gt; appointments = new ArrayList&lt;Encounter&gt;(size);
          for (int i = 0; i &lt; size; i++) {appointments.add(null);}
          return appointments;
      }
  }
  </code></pre>
  
  <p>And here is the complete stack trace.  Notice that they <code>system.out.println()</code> output at the start shows that the methods are firing in the correct order, and that there is a value for the <code>day</code> property:  </p>
  
  <pre><code>------------------------ in controller, day of month is:  6
  :::::::::::::::::::::::::: in AppointmentCalendar constructor, dayOfMonth is: 6
  Feb 6, 2014 1:34:21 PM org.apache.jasper.compiler.TldLocationsCache tldScanJar
  INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
  Feb 6, 2014 1:34:22 PM org.apache.catalina.core.ApplicationDispatcher invoke
  SEVERE: Servlet.service() for servlet jsp threw exception
  org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 9): Field or property 'day' cannot be found on object of type 'org.springframework.samples.knowledgemanager.model.AppointmentCalendar'
      at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:216)
      at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:85)
      at org.springframework.expression.spel.ast.PropertyOrFieldReference.access$000(PropertyOrFieldReference.java:43)
      at org.springframework.expression.spel.ast.PropertyOrFieldReference$AccessorLValue.getValue(PropertyOrFieldReference.java:346)
      at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:82)
      at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:102)
      at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:98)
      at org.springframework.web.servlet.tags.EvalTag.doEndTag(EvalTag.java:126)
      at org.apache.jsp.WEB_002dINF.jsp.appointments.calendar_jsp._jspx_meth_spring_005feval_005f0(calendar_jsp.java:217)
      at org.apache.jsp.WEB_002dINF.jsp.appointments.calendar_jsp._jspService(calendar_jsp.java:114)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
      at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
      at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:263)
      at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1208)
      at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:992)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:939)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at com.github.dandelion.datatables.core.web.filter.DatatablesFilter.doFilter(DatatablesFilter.java:73)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at com.github.dandelion.datatables.extras.servlet2.filter.DatatablesFilter.doFilter(DatatablesFilter.java:71)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)
  Feb 6, 2014 1:34:22 PM org.apache.catalina.core.StandardWrapperValve invoke
  SEVERE: Servlet.service() for servlet [KnowledgeManager] in context with path [/KnowledgeManager] threw exception [org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 9): Field or property 'day' cannot be found on object of type 'org.springframework.samples.knowledgemanager.model.AppointmentCalendar'] with root cause
  org.springframework.expression.spel.SpelEvaluationException: EL1008E:(pos 9): Field or property 'day' cannot be found on object of type 'org.springframework.samples.knowledgemanager.model.AppointmentCalendar'
      at org.springframework.expression.spel.ast.PropertyOrFieldReference.readProperty(PropertyOrFieldReference.java:216)
      at org.springframework.expression.spel.ast.PropertyOrFieldReference.getValueInternal(PropertyOrFieldReference.java:85)
      at org.springframework.expression.spel.ast.PropertyOrFieldReference.access$000(PropertyOrFieldReference.java:43)
      at org.springframework.expression.spel.ast.PropertyOrFieldReference$AccessorLValue.getValue(PropertyOrFieldReference.java:346)
      at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:82)
      at org.springframework.expression.spel.ast.SpelNodeImpl.getTypedValue(SpelNodeImpl.java:102)
      at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:98)
      at org.springframework.web.servlet.tags.EvalTag.doEndTag(EvalTag.java:126)
      at org.apache.jsp.WEB_002dINF.jsp.appointments.calendar_jsp._jspx_meth_spring_005feval_005f0(calendar_jsp.java:217)
      at org.apache.jsp.WEB_002dINF.jsp.appointments.calendar_jsp._jspService(calendar_jsp.java:114)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
      at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
      at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:263)
      at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1208)
      at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:992)
      at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:939)
      at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
      at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
      at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
      at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:812)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at com.github.dandelion.datatables.core.web.filter.DatatablesFilter.doFilter(DatatablesFilter.java:73)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at com.github.dandelion.datatables.extras.servlet2.filter.DatatablesFilter.doFilter(DatatablesFilter.java:71)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:662)
  </code></pre>