Confluence Will Not Start Due to NoSuchMethodError (getContextPath)

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Symptoms

Confluence does not start.

The following appears in catalina.out:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 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

ℹ️ There may be other causes and resolutions to this issue besides what is listed here

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.