Confluence Will Not Start Due to NoSuchMethodError (getContextPath)

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

Confluence does not start.

The following appears in catalina.out:

INFO: Starting Servlet Engine: Apache Tomcat/6.0.32
java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String;
        at org.apache.catalina.core.StandardHost$MemoryLeakTrackingListener.lifecycleEvent(StandardHost.java:616)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4699)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
        at org.apache.catalina.core.StandardService.start(StandardService.java:525)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
        ... 6 more

Cause

This error happens when there is something in the JVM's classpath that interferes with the Servlet engine, causing it to be incompatible with 2.5 or above. Tomcat's bootstrap JAR requires Servlet engine 2.5 or above, which contains the "getContextPath" method in javax.servlet.ServletContext.

Here are some possible reasons why this could happen:

  1. There is a JAR file in the classpath that is interfering with the servlet engine
  2. The web.xml is setting the servlet version below 2.5
  3. There is a JDK extension that is interfering with the servlet engine
  4. The JDK version is too old (Servlet 2.5 was introduced in JDK 1.5)

Resolution

  • Determine which of the potential causes is the culprit and apply a fix. For example:
    • Remove the interfering JAR from the classpath
    • Modify web.xml to use the correct servlet version
    • Upgrade your JDK

(info) There may be other causes and resolutions to this issue besides what is listed here

Last modified on Mar 30, 2016

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.