UglySwede
UglySwede

Reputation: 459

Trouble running Grails application on Tomcat

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?

When I look at the Tomcat log (catalina.out), this is logged:

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

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...

Is there anything I need to install on the server? Anything to add to Tomcat? Or some configuration I should change in my application?

I'd be very grateful for any help! :-)

/Anders from Sweden

Upvotes: 3

Views: 3423

Answers (1)

dmahapatro
dmahapatro

Reputation: 50245

It is a piece of cake if an appropriate version of Tomcat with this version of Grails is used. :)

Latest version of Grails uses Servlet 3.0 and embedded Tomcat 7.0.52.1 (used during run-app) by default and I doubt it will be compatible with Tomcat 6.0.35. But you can downgrade the servlet version to 2.5 or 2.4 according to your need as:

//BuildConfig.groovy (first line)
grails.servlet.version = "3.0" //2.4 or 2.5

Upvotes: 5

Related Questions