title: 500 internal server error on Tomcat7 while trying to do ajax getJson or post operation in jQuery + Struts2
body: <p>[SOLVED] Name of action turned out to be case sensitive</p>
  
  <p>I want to do an ajax request to server in order to get a JSON. I am using struts2 package configured in this way</p>
  
  <pre><code>&lt;package name="it.polito.ai.e3" namespace=""
      extends="struts-default,json-default"&gt;
      &lt;action name="getDay" class="it.polito.ai.e3.GetDayAction" &gt;
          &lt;result name="success" type="json" /&gt;
          &lt;result name="error" type="json" /&gt;
      &lt;/action&gt;
  &lt;/package&gt;
  </code></pre>
  
  <p>GetDayAction class is</p>
  
  <pre><code>package it.polito.ai.e3;
  
  import java.util.Date;
  
  import com.opensymphony.xwork2.Action;
  import com.opensymphony.xwork2.ActionContext;
  import com.opensymphony.xwork2.ActionSupport;
  
  @SuppressWarnings("serial")
  public class GetDayAction extends ActionSupport
  {
  private String startDate;
  
  public String execute()
  {
      try
      {
          System.out.println("Ciao");
          System.out.println(startDate);
      }
      catch (Exception e)
      {
          e.printStackTrace();
          return Action.ERROR;
      }
  
      return Action.SUCCESS;
  }
  
  public String getStartDate()
  {
      return startDate;
  }
  
  public void setStartDate(String startDate)
  {
      this.startDate = startDate;
  }
  
  }
  </code></pre>
  
  <p>jQuery post block is</p>
  
  <pre><code>$(function() {
      $.post('getday.action', document.getElementById('startDate').innerHTML,
          function(data) {
  
          });  
  });
  </code></pre>
  
  <p>in case of get jQuery block is</p>
  
  <pre><code>$(function() {
      $.getJSON('getday.action', document.getElementById('startDate').innerHTML,
          function(data) {
  
          });  
  });
  </code></pre>
  
  <p><code>document.getElementById('startDate').innerHTML</code> gets a Date formatted in a string.</p>
  
  <p>When it executes get or post via ajax, Tomcat gives me 500 internal server error and this stacktrace</p>
  
  <pre><code>java.lang.NullPointerException
  org.apache.struts2.impl.StrutsActionProxy.getErrorMessage(StrutsActionProxy.java:69)
  com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
  org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)
  org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:39)
  com.opensymphony.xwork2.DefaultActionProxyFactory.createActionProxy(DefaultActionProxyFactory.java:58)
  org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:500)
  org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:434)
  </code></pre>
  
  <p>Tomcat7 console doesn't show up anything, neither System.out.println() nor other messages.</p>
  
  <p>I have no clue about what I am doing wrong.
  Thanks</p>