title: Trouble running Grails application on Tomcat
body: <p>I'm trying to deploy a Grails application to a Tomcat container, running on Ubuntu. I was trying to do "everything right", but still can't get it to work. Any ideas?</p>
  
  <ul>
  <li><p>I'm running "Ubuntu Server 12.04.3 LTS". I installed the Tomcat that is bundled with Ubuntu (6.0.35). I know Grails can use a lot of memory, so I raised the memory allocated to the JVM to 512MB. The example applications supplied with Tomcat work fine.</p></li>
  <li><p>On my PC (running Windows 7) I installed Grails (latest version: 2.3.7) and NetBeans (version: 7.4).</p></li>
  <li><p>I created a very simple "Hello world" Grails application. I have some trouble running it on my PC (another question I just posted), but it compiles just fine and I can create a War-file without problems. By running "grails war".</p></li>
  <li><p>I've used the Tomcat "Web Application Manager" to upload the War-file. It is put in /var/lib/tomcat6/webapps as it should, unpacked and everything looks fine.</p></li>
  <li><p>But when I try to start the application (choosing "Start" in the manager), I get a "FAIL - Application at context path /MyTestApp could not be started" message. I've tried to restart Tomcat, but get the same problem.</p></li>
  </ul>
  
  <p>When I look at the Tomcat log (catalina.out), this is logged:</p>
  
  <pre><code>2014-03-14 20:24:32,148 [http-8080-1] ERROR context.ContextLoader  - Context
  initialization failed
  org.springframework.beans.factory.BeanCreationException:
  Error creating bean with name 'grailsApplication' defined in ServletContext
  resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed;
  nested exception is java.lang.NoClassDefFoundError: javax/servlet/AsyncContext
  at java.lang.Thread.run(Thread.java:701) Caused by:
  java.lang.NoClassDefFoundError: javax/servlet/AsyncContext
  at java.lang.Class.privateGetDeclaredMethods(Class.java:2534)
  at java.lang.Class.getDeclaredMethods(Class.java:1855)
  ...
  Caused by: java.lang.ClassNotFoundException: javax.servlet.AsyncContext
  </code></pre>
  
  <p>It seems like the "javax.servlet.AsyncContext" class couldn't be found. The Grails documentation says that running Grails on Tomcat is a piece of cake, and that nothing should go wrong... The "javax.servlet.AsyncContext" class seems to have something to do with "Servlet 3.0", but I don't know much about Java EE. I just thought latest-version-of-everything would work out of the box...</p>
  
  <p>Is there anything I need to install on the server? Anything to add to Tomcat? Or some configuration I should change in my application?</p>
  
  <p>I'd be very grateful for any help! :-)</p>
  
  <p>/Anders from Sweden</p>