It looks like you're linking to an older version of the Servlet API at runtime.
A getContextPath() method returning String was added to javax.servlet.ServletContext in version 2.5 of the Servlet spec, which is what GlassFish 9.x has been using.
[Message sent by forum member 'jluehe' (jluehe)]
http://forums.java.net/jive/thread.jspa?messageID=232763