ClassNotFoundException: javax.servlet.ServletContext When Starting Bitbucket Server WAR in Tomcat 7

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

The following appears in the atlassian-bitbucket.log while deploying the Bitbucket Server WAR Version:

1 2 3 4 5 6 7 INFO: Deploying configuration descriptor /opt/apache-tomcat-7.0.29/conf/Catalina/localhost/bitbucket.xml Exception in thread "Spring executor 7" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'handler' defined in URL [bundle://26.0:0/META-INF/spring/web-context.xml]: Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/servlet/ServletContext ... Caused by: java.lang.NoClassDefFoundError: javax/servlet/ServletContext ... Caused by: java.lang.ClassNotFoundException: javax.servlet.ServletContext ...

Cause

This ERROR happens because your are trying to deploy Bitbucket Server on an Apache Tomcat 7 which is not supported yet: Supported platforms.

Resolution

Downgrade your Apache Tomcat 7 to an Apache Tomcat 6 and try to deploy the Application again or otherwise you can always use the embedded Tomcat.

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.