views:

285

answers:

1

[UPDATE]

Apparently I'm not the only one with this problem - http://grails.1312388.n4.nabble.com/Beginner-ERROR-Failed-to-invoke-Servlet-2-5-getContextPath-method-td2222279.html . It has also appeared on a Windows machine and in the Netbeans IDE on OS X.

At this point, the part that has me particularly perplexed, is I can run my Grails apps just fine from within Eclipse, but the second I try to run them from the Terminal they bomb. As far as I can tell, they are both being run from the grails-core directory, so why would it work from within Eclipse but not from the Terminal?

[/UPDATE]

I'm trying to get Grails set up on a Snow Leopard machine. I followed all the grails.com install directions and am trying to start the application from Grails: A Quick-Start Guide by Dave Klein. I ran grails create-app TekDays with no apparent problems and was able to cd to the TekDays folder, but when I try to run grails run-app I get the following:

Welcome to Grails 1.3.1 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /grails

Base Directory: /apps/TekDays
Resolving dependencies...
Dependencies resolved in 4469ms.
Running script /grails/scripts/RunApp.groovy
Environment set to development
   [delete] Deleting directory /Users/name/.grails/1.3.1/projects/TekDays/tomcat
Running Grails application..
2010-05-24 21:42:39,559 [main] ERROR context.GrailsContextLoader  - Error executing bootstraps: Failed to invoke Servlet 2.5 getContextPath method
java.lang.IllegalStateException: Failed to invoke Servlet 2.5 getContextPath method
    at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:164)
    at grails.web.container.EmbeddableServer$start.call(Unknown Source)
    at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:159)
    at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy)
    at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:282)
    at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
    at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:150)
    at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy)
    at _GrailsRun_groovy.runInline(_GrailsRun_groovy:116)
    at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy)
    at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59)
    at RunApp$_run_closure1.doCall(RunApp.groovy:33)
    at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
    at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
    at gant.Gant.withBuildListeners(Gant.groovy:427)
    at gant.Gant.this$2$withBuildListeners(Gant.groovy)
    at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
    at gant.Gant.dispatch(Gant.groovy:415)
    at gant.Gant.this$2$dispatch(Gant.groovy)
    at gant.Gant.invokeMethod(Gant.groovy)
    at gant.Gant.executeTargets(Gant.groovy:590)
    at gant.Gant.executeTargets(Gant.groovy:589)
Caused by: java.lang.NoSuchMethodException: javax.servlet.ServletContext.getContextPath()
    at java.lang.Class.getMethod(Class.java:1605)
    ... 23 more

I've googled every derivative of "Failed to invoke Servlet 2.5" that I can think of, but have thus far been unable to find anything that helps me understand, yet alone resolve, the error.

Any advice to help me resolve this would be very much appreciated!

A: 

Look for a servlet-api jar file in /lib and delete it.

In my case I had servlet-api-2.3.jar, which was imported by another dependency. The error specifically states getContextPath is a Servlet 2.5 method.

Andre van der Schyff
Thanks for the suggestion. Sadly it didn't work. At this point I can work through the beginner grails books via Eclipse, but even after starting from scratch (i.e., deleting the <code>grails</code> and <code>grails-1.3.1</code> directories) and starting from scratch with the git version (including an intervening Grails upgrade) I'm still getting the same <code>[main] ERROR context.GrailsContextLoader - Error executing bootstraps: Failed to invoke Servlet 2.5 getContextPath methodjava.lang.IllegalStateException: Failed to invoke Servlet 2.5 getContextPath method ...</code> error.
A Lion
Any other suggestions? (Sometimes I really prefer having the option to work via TextMate and Terminal.)
A Lion

related questions