Bitbucket Won't start after update 7 to 8 SpringMVC dispatcher [springMvc] could not be started
Asked by ADMiNZ:

After the update it won't start. no solution was found for errors in the log.

2022-10-09 17:37:56,051 ERROR \[spring-startup\] c.a.j.s.w.s.JohnsonDispatcherServlet SpringMVC dispatcher \[springMvc\] could not be started  
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'fileServerServlet' defined in URL \[jar:file:/opt/atlassian/bitbucket/app/WEB-INF/lib/bitbucket-platform-8.4.1.jar!/com/atlassian/stash/internal/plugin/FileServerServlet.class\]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginResourceDownload' defined in class path resource \[stash-context.xml\]: Cannot resolve reference to bean 'contentTypeResolver' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contentTypeResolver' defined in URL \[jar:file:/opt/atlassian/bitbucket/app/WEB-INF/lib/bitbucket-platform-8.4.1.jar!/com/atlassian/stash/internal/plugin/SimpleContentTypeResolver.class\]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate \[com.atlassian.stash.internal.plugin.SimpleContentTypeResolver\]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport  
at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:800)  
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)  
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)  
at javax.servlet.GenericServlet.init(GenericServlet.java:158)  
at java.base/java.lang.Thread.run(Thread.java:829)  
... 18 frames trimmed  
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pluginResourceDownload' defined in class path resource \[stash-context.xml\]: Cannot resolve reference to bean 'contentTypeResolver' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contentTypeResolver' defined in URL \[jar:file:/opt/atlassian/bitbucket/app/WEB-INF/lib/bitbucket-platform-8.4.1.jar!/com/atlassian/stash/internal/plugin/SimpleContentTypeResolver.class\]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate \[com.atlassian.stash.internal.plugin.SimpleContentTypeResolver\]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport  
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:342)  
... 5 common frames omitted  
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contentTypeResolver' defined in URL \[jar:file:/opt/atlassian/bitbucket/app/WEB-INF/lib/bitbucket-platform-8.4.1.jar!/com/atlassian/stash/internal/plugin/SimpleContentTypeResolver.class\]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate \[com.atlassian.stash.internal.plugin.SimpleContentTypeResolver\]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport  
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1334)  
... 5 common frames omitted  
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate \[com.atlassian.stash.internal.plugin.SimpleContentTypeResolver\]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport  
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:224)  
... 5 common frames omitted  
Caused by: java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport  
at javax.activation.MimetypesFileTypeMap.\<init\>(MimetypesFileTypeMap.java:130)  
at javax.activation.MimetypesFileTypeMap.\<init\>(MimetypesFileTypeMap.java:301)  
at com.atlassian.stash.internal.plugin.SimpleContentTypeResolver.\<init\>(SimpleContentTypeResolver.java:25)  
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)  
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)  
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)  
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211)  
... 5 common frames omitted  
Caused by: java.lang.ClassNotFoundException: com.sun.activation.registries.LogSupport  
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)  
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)  
... 12 common frames omitted  
2022-10-09 17:38:00,833 WARN \[http-nio-7990-exec-1\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[hazelcastFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:00,834 WARN \[http-nio-7990-exec-1\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[requestAttributeFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:00,835 WARN \[http-nio-7990-exec-1\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[entityMovedFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:00,835 WARN \[http-nio-7990-exec-1\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[pluginProvidedAuthenticationFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:00,835 WARN \[http-nio-7990-exec-1\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[trustedApplicationsAuthenticationFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:00,835 WARN \[http-nio-7990-exec-1\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[goGetFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:00,851 WARN \[http-nio-7990-exec-1\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[requestAttributeFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:00,852 WARN \[http-nio-7990-exec-1\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[entityMovedFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:00,852 WARN \[http-nio-7990-exec-1\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[trustedApplicationsAuthenticationFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:00,852 WARN \[http-nio-7990-exec-1\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[springSecurityFilterChain\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:00,852 WARN \[http-nio-7990-exec-1\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[authenticationAttributeFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:00,852 WARN \[http-nio-7990-exec-1\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[rateLimitFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:00,852 WARN \[http-nio-7990-exec-1\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[standardResponseHeadersFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:00,856 WARN \[http-nio-7990-exec-1\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[requestAttributeFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:00,856 WARN \[http-nio-7990-exec-1\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[entityMovedFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:00,856 WARN \[http-nio-7990-exec-1\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[trustedApplicationsAuthenticationFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:00,856 WARN \[http-nio-7990-exec-1\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[springSecurityFilterChain\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:00,856 WARN \[http-nio-7990-exec-1\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[authenticationAttributeFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:00,856 WARN \[http-nio-7990-exec-1\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[rateLimitFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:00,857 WARN \[http-nio-7990-exec-1\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[standardResponseHeadersFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:01,477 WARN \[http-nio-7990-exec-2\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[hazelcastFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:01,478 WARN \[http-nio-7990-exec-2\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[requestAttributeFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,081 WARN \[http-nio-7990-exec-3\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[hazelcastFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,081 WARN \[http-nio-7990-exec-3\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[requestAttributeFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,122 WARN \[http-nio-7990-exec-4\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[hazelcastFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,122 WARN \[http-nio-7990-exec-4\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[requestAttributeFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,122 WARN \[http-nio-7990-exec-4\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[entityMovedFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,122 WARN \[http-nio-7990-exec-4\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[pluginProvidedAuthenticationFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,123 WARN \[http-nio-7990-exec-4\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[trustedApplicationsAuthenticationFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,123 WARN \[http-nio-7990-exec-4\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[goGetFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,124 WARN \[http-nio-7990-exec-4\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[requestAttributeFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,125 WARN \[http-nio-7990-exec-4\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[entityMovedFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,125 WARN \[http-nio-7990-exec-4\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[trustedApplicationsAuthenticationFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,125 WARN \[http-nio-7990-exec-4\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[springSecurityFilterChain\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,125 WARN \[http-nio-7990-exec-4\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[authenticationAttributeFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,125 WARN \[http-nio-7990-exec-4\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[rateLimitFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,126 WARN \[http-nio-7990-exec-4\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[standardResponseHeadersFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,126 WARN \[http-nio-7990-exec-4\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[requestAttributeFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,126 WARN \[http-nio-7990-exec-4\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[entityMovedFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,127 WARN \[http-nio-7990-exec-4\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[trustedApplicationsAuthenticationFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,127 WARN \[http-nio-7990-exec-4\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[springSecurityFilterChain\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,127 WARN \[http-nio-7990-exec-4\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[authenticationAttributeFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,127 WARN \[http-nio-7990-exec-4\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[rateLimitFilter\]; no Spring WebApplicationContext is available  
2022-10-09 17:38:02,127 WARN \[http-nio-7990-exec-4\] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing \[standardResponseHeadersFilter\]; no Spring WebApplicationContext is available


Answers:
author: ?????? ????????
body: Hey Guys!  
I also have such error and I've tried to setup Oracle JDK 8, 11 and OpenJDK 8, 11 and with all of them Bitbucket restarts all the time.

<br />

Here is log with original start:

```
2024-07-27 23:20:34 INFO:root:User is currently root. Will downgrade run user to bitbucket
2024-07-27 23:20:34 INFO:root:Running Bitbucket with command '/opt/atlassian/bitbucket/bin/exec-bitbucket-node.sh', arguments ['/opt/atlassian/bitbucket/bin/exec-bitbucket-node.sh']
2024-07-27 23:20:34 /opt/atlassian/bitbucket/bin/_exec-webapp.sh: line 64: \nStarting Bitbucket webapp at http://localhost:${bitbucket.http.port}${bitbucket.context}: bad substitution
2024-07-27 23:20:34 Starting Atlassian Bitbucket as the current user
2024-07-27 23:20:34 Starting Atlassian Bitbucket as the current user
2024-07-27 23:20:35 20:20:35.642 [main] INFO com.atlassian.security.serialfilter.DeserializationFilterConfigurator - Global serial filter set to JDK 11 DeserializationFilter
2024-07-27 23:20:37 2024-07-27 20:20:37,179 INFO [main] c.a.b.i.b.BitbucketServerApplication Starting BitbucketServerApplication v8.9.8 using Java 17.0.12 on bitbucket with PID 7 (/opt/atlassian/bitbucket/app/WEB-INF/classes started by bitbucket in /var/atlassian/application-data/bitbucket)
2024-07-27 23:20:37 2024-07-27 20:20:37,181 INFO [main] c.a.b.i.b.BitbucketServerApplication No active profile set, falling back to 1 default profile: "default"
2024-07-27 23:20:38 2024-07-27 20:20:38,318 INFO [main] c.a.b.i.boot.log.BuildInfoLogger Starting Bitbucket 8.9.8 (1ae6adb built on Mon Dec 11 03:12:09 UTC 2023)
2024-07-27 23:20:38 2024-07-27 20:20:38,318 INFO [main] c.a.b.i.boot.log.BuildInfoLogger JVM: Eclipse Adoptium OpenJDK 64-Bit Server VM 17.0.12+7
2024-07-27 23:20:39 2024-07-27 20:20:39,772 INFO [main] c.a.b.i.b.BitbucketServerApplication Started BitbucketServerApplication in 3.934 seconds (JVM running for 5.432)
2024-07-27 23:20:43 2024-07-27 20:20:43,068 INFO [spring-startup] c.a.s.internal.home.HomeLockAcquirer Successfully acquired lock on home directory /var/atlassian/application-data/bitbucket
2024-07-27 23:20:43 2024-07-27 20:20:43,079 WARN [spring-startup] c.a.s.internal.home.HomeValidator Downgrading Bitbucket from 9.0.0 to 8.9.8
2024-07-27 23:20:46 2024-07-27 20:20:46,740 INFO [spring-startup] c.a.s.internal.home.HomeLockAcquirer Successfully acquired lock on home directory /var/atlassian/application-data/bitbucket/shared
2024-07-27 23:20:48 2024-07-27 20:20:48,232 WARN [spring-startup] com.hazelcast.instance.Node [172.18.0.5]:5701 [bitbucket] [3.12.13] No join method is enabled! Starting standalone.
2024-07-27 23:21:04 2024-07-27 20:21:04,409 INFO [spring-startup] c.a.s.i.s.g.m.DefaultSidecarManager Sidecar started after 6024ms
2024-07-27 23:21:04 2024-07-27 20:21:04,903 WARN [spring-startup] o.s.w.c.s.XmlWebApplicationContext Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contentTypeResolver' defined in URL [jar:file:/opt/atlassian/bitbucket/app/WEB-INF/lib/bitbucket-platform-8.9.8.jar!/com/atlassian/stash/internal/plugin/SimpleContentTypeResolver.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.atlassian.stash.internal.plugin.SimpleContentTypeResolver]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport
2024-07-27 23:21:05 2024-07-27 20:21:05,729 INFO [spring-startup] c.a.s.i.s.g.m.DefaultSidecarManager Sidecar has stopped (Exit code: 0)
2024-07-27 23:21:05 2024-07-27 20:21:05,786 INFO [spring-startup] c.a.s.internal.home.HomeLockAcquirer Releasing lock on /var/atlassian/application-data/bitbucket/shared
2024-07-27 23:21:05 2024-07-27 20:21:05,797 INFO [spring-startup] c.a.s.internal.home.HomeLockAcquirer Releasing lock on /var/atlassian/application-data/bitbucket
2024-07-27 23:21:05 2024-07-27 20:21:05,801 ERROR [spring-startup] c.a.j.s.w.s.JohnsonDispatcherServlet SpringMVC dispatcher [springMvc] could not be started
2024-07-27 23:21:05 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contentTypeResolver' defined in URL [jar:file:/opt/atlassian/bitbucket/app/WEB-INF/lib/bitbucket-platform-8.9.8.jar!/com/atlassian/stash/internal/plugin/SimpleContentTypeResolver.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.atlassian.stash.internal.plugin.SimpleContentTypeResolver]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport
2024-07-27 23:21:05 at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1334)
2024-07-27 23:21:05 at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:929)
2024-07-27 23:21:05 at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:591)
2024-07-27 23:21:05 at javax.servlet.GenericServlet.init(GenericServlet.java:143)
2024-07-27 23:21:05 at java.base/java.lang.Thread.run(Thread.java:840)
2024-07-27 23:21:05 ... 16 frames trimmed
2024-07-27 23:21:05 Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.atlassian.stash.internal.plugin.SimpleContentTypeResolver]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport
2024-07-27 23:21:05 at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:226)
2024-07-27 23:21:05 ... 5 common frames omitted
2024-07-27 23:21:05 Caused by: java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport
2024-07-27 23:21:05 at javax.activation.MimetypesFileTypeMap.<init>(MimetypesFileTypeMap.java:130)
2024-07-27 23:21:05 at javax.activation.MimetypesFileTypeMap.<init>(MimetypesFileTypeMap.java:301)
2024-07-27 23:21:05 at com.atlassian.stash.internal.plugin.SimpleContentTypeResolver.<init>(SimpleContentTypeResolver.java:25)
2024-07-27 23:21:05 at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
2024-07-27 23:21:05 at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
2024-07-27 23:21:05 at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
2024-07-27 23:21:05 at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:213)
2024-07-27 23:21:05 ... 5 common frames omitted
2024-07-27 23:21:05 Caused by: java.lang.ClassNotFoundException: com.sun.activation.registries.LogSupport
2024-07-27 23:21:05 at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
2024-07-27 23:21:05 at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
2024-07-27 23:21:05 ... 12 common frames omitted


?
```

<br />

Docker-compose part for this log:

```


 bitbucket:
image: atlassian/bitbucket:8.9.8-ubuntu-jdk17
container_name: bitbucket
hostname: bitbucket
restart: always
environment:
BITBUCKET_HOME: /var/atlassian/application-data/bitbucket/
JDBC_DRIVER: org.postgresql.Driver
JDBC_URL: 'jdbc:postgresql://postgres-sql-infrastructure:5432/bitbucket'
JDBC_USER: 'jira'
JDBC_PASSWORD: 'DA.13jpj93%eBw_Q'
SEARCH_ENABLED: 'false'
# OPENSEARCH_URL: 'http://opensearch:9200'
#SERVER_SCHEME: 'https'
#SERVER_SECURE: 'true'
#SERVER_PROXY_PORT: '443'
#SERVER_PROXY_NAME: 'bitbucket.mysite.com'
JVM_MINIMUM_MEMORY: 512m
JVM_MAXIMUM_MEMORY: 2048m
volumes:
- bitbucket_data:/var/atlassian/application-data/bitbucket
networks:
- ${GLOBAL_NETWORK}
depends_on:
- postgres-sql-infrastructure
# - opensearch
ports:
- 7990:7990
- 7999:7999
```

<br />

<br />

To setup custom Java version I've used scripts generated with ChatGPT like this:  
Dockerfile:

```
# Use the official Atlassian Bitbucket Server image as a base
FROM atlassian/bitbucket:8.6.1

# Install necessary packages
RUN apt-get update && apt-get install -y wget tar

# Download and install Eclipse Temurin OpenJDK 11
RUN wget https://github.com/adoptium/temurin11-binaries/releases/download/jdk-11.0.18%2B10/OpenJDK11U-jdk_x64_linux_hotspot_11.0.18_10.tar.gz -O /tmp/OpenJDK11U-jdk_x64_linux.tar.gz && \
mkdir -p /usr/lib/jvm && \
tar -xzf /tmp/OpenJDK11U-jdk_x64_linux.tar.gz -C /usr/lib/jvm && \
rm /tmp/OpenJDK11U-jdk_x64_linux.tar.gz && \
mv /usr/lib/jvm/jdk-11* /usr/lib/jvm/temurin-java11

# Set JAVA_HOME to Temurin OpenJDK 11
ENV JAVA_HOME=/usr/lib/jvm/temurin-java11
ENV PATH=$JAVA_HOME/bin:$PATH

# Verify the Java installation
RUN java -version

# Copy the custom start script
COPY start-bitbucket-custom.sh /opt/atlassian/bitbucket/bin/start-bitbucket-custom.sh

# Make the custom start script executable
RUN chmod +x /opt/atlassian/bitbucket/bin/start-bitbucket-custom.sh

# Define the entry point script
ENTRYPOINT ["/opt/atlassian/bitbucket/bin/start-bitbucket-custom.sh"]
```

<br />

start-bitbucket-custom.sh:

```
#!/bin/bash

# Set JAVA_HOME to Temurin OpenJDK 11
export JAVA_HOME=/usr/lib/jvm/temurin-java11
export PATH=$JAVA_HOME/bin:$PATH

# Log the Java version being used
echo "Using Java version:"
java -version

# Start Bitbucket
exec /opt/atlassian/bitbucket/bin/start-bitbucket.sh "$@"
```

<br />

Log for such setup:

```

2024-07-27 22:56:45 Using Java version:
2024-07-27 22:56:46 Starting Atlassian Bitbucket as the current user
2024-07-27 22:56:49 
2024-07-27 22:56:49 Starting the bundled search server
2024-07-27 22:56:49 Hint: Run start-bitbucket.sh --no-search to skip starting the bundled search server
2024-07-27 22:56:52 Bundled search server started successfully
2024-07-27 22:56:52 
2024-07-27 22:56:46 openjdk version "11.0.18" 2023-01-17
2024-07-27 22:56:46 OpenJDK Runtime Environment Temurin-11.0.18+10 (build 11.0.18+10)
2024-07-27 22:56:46 OpenJDK 64-Bit Server VM Temurin-11.0.18+10 (build 11.0.18+10, mixed mode)
2024-07-27 22:56:52 Bitbucket is being run with a umask that contains potentially unsafe settings.
2024-07-27 22:56:52 The following issues were found with the mask "u=rwx,g=rx,o=rx" (0022):
2024-07-27 22:56:52 - Access is allowed to 'others'. It is recommended that 'others' be denied
2024-07-27 22:56:52 all access for security reasons.
2024-07-27 22:56:52 The recommended umask for Bitbucket is "u=,g=w,o=rwx" (0027) and can be
2024-07-27 22:56:52 configured in _start-webapp.sh
2024-07-27 22:56:52 
2024-07-27 22:56:52 Starting Bitbucket webapp at http://localhost:7990
2024-07-27 22:56:52 The Bitbucket webapp has been started.
2024-07-27 22:56:52 
2024-07-27 22:56:52 If you cannot access Bitbucket within 3 minutes, or encounter other issues, check the troubleshooting guide at:
2024-07-27 22:56:52 https://go.atlassian.com/bbs-troubleshooting-installations
2024-07-27 22:56:53 Using Java version:
2024-07-27 22:56:53 Starting Atlassian Bitbucket as the current user
2024-07-27 22:56:55 
2024-07-27 22:56:55 Starting the bundled search server
2024-07-27 22:56:55 Hint: Run start-bitbucket.sh --no-search to skip starting the bundled search server
2024-07-27 22:56:58 Bundled search server started successfully
2024-07-27 22:56:58 
2024-07-27 22:56:58 Bitbucket is being run with a umask that contains potentially unsafe settings.
2024-07-27 22:56:58 The following issues were found with the mask "u=rwx,g=rx,o=rx" (0022):
2024-07-27 22:56:58 - Access is allowed to 'others'. It is recommended that 'others' be denied
2024-07-27 22:56:58 all access for security reasons.
2024-07-27 22:56:58 The recommended umask for Bitbucket is "u=,g=w,o=rwx" (0027) and can be
2024-07-27 22:56:58 configured in _start-webapp.sh
2024-07-27 22:56:58 
2024-07-27 22:56:58 Starting Bitbucket webapp at http://localhost:7990
2024-07-27 22:56:58 The Bitbucket webapp has been started.
2024-07-27 22:56:58 
2024-07-27 22:56:58 If you cannot access Bitbucket within 3 minutes, or encounter other issues, check the troubleshooting guide at:
2024-07-27 22:56:58 https://go.atlassian.com/bbs-troubleshooting-installations
2024-07-27 22:56:59 Using Java version:
2024-07-27 22:56:59 Starting Atlassian Bitbucket as the current user
2024-07-27 22:57:01 
2024-07-27 22:57:01 Starting the bundled search server
2024-07-27 22:57:01 Hint: Run start-bitbucket.sh --no-search to skip starting the bundled search server
2024-07-27 22:57:04 Bundled search server started successfully
2024-07-27 22:57:04 
2024-07-27 22:57:04 Bitbucket is being run with a umask that contains potentially unsafe settings.
2024-07-27 22:57:04 The following issues were found with the mask "u=rwx,g=rx,o=rx" (0022):
2024-07-27 22:57:04 - Access is allowed to 'others'. It is recommended that 'others' be denied
2024-07-27 22:57:04 all access for security reasons.
2024-07-27 22:57:04 The recommended umask for Bitbucket is "u=,g=w,o=rwx" (0027) and can be
2024-07-27 22:57:04 configured in _start-webapp.sh
2024-07-27 22:57:04 
2024-07-27 22:57:04 Starting Bitbucket webapp at http://localhost:7990
2024-07-27 22:57:04 The Bitbucket webapp has been started.
2024-07-27 22:57:04 
2024-07-27 22:57:04 If you cannot access Bitbucket within 3 minutes, or encounter other issues, check the troubleshooting guide at:
2024-07-27 22:57:04 https://go.atlassian.com/bbs-troubleshooting-installations
2024-07-27 22:57:05 Using Java version:
2024-07-27 22:57:05 Starting Atlassian Bitbucket as the current user
2024-07-27 22:57:07 
2024-07-27 22:57:07 Starting the bundled search server
2024-07-27 22:57:07 Hint: Run start-bitbucket.sh --no-search to skip starting the bundled search server
2024-07-27 22:57:10 Bundled search server started successfully
2024-07-27 22:57:10 
2024-07-27 22:57:10 Bitbucket is being run with a umask that contains potentially unsafe settings.
2024-07-27 22:57:10 The following issues were found with the mask "u=rwx,g=rx,o=rx" (0022):
2024-07-27 22:57:10 - Access is allowed to 'others'. It is recommended that 'others' be denied
2024-07-27 22:57:10 all access for security reasons.
2024-07-27 22:57:10 The recommended umask for Bitbucket is "u=,g=w,o=rwx" (0027) and can be
2024-07-27 22:57:10 configured in _start-webapp.sh
2024-07-27 22:57:10 
2024-07-27 22:57:10 Starting Bitbucket webapp at http://localhost:7990
2024-07-27 22:57:10 The Bitbucket webapp has been started.
2024-07-27 22:57:10 
2024-07-27 22:57:10 If you cannot access Bitbucket within 3 minutes, or encounter other issues, check the troubleshooting guide at:
2024-07-27 22:57:10 https://go.atlassian.com/bbs-troubleshooting-installations
```


author: Nick Murray
body: Java 8 is deprecated as on 8.17.0 and is therefore not a long term solution. Does anyone know how to fix this with Java 17? I've tried both Oracle and OepnJDK versions and both throw the same error.


author: Evan huang
body: same issue


author: Gonchik Tsymzhitov
body: met with that. and unclear how to fix it?

comments: author: Gonchik Tsymzhitov
body: java 8 helped


author: roamerxv
body: I have the the situation. Is there a solution?

Bitbucket Server 8.8.2

Git 2.37

comments: author: Gonchik Tsymzhitov
body: java 8


author: Gonchik Tsymzhitov
body: Hello everyone  
Faced with a similar situation. Is there a solution?

Bitbucket Server 8.6.1

Git 2.34.1

atlassian-bitbucket.log

```
2022-12-25 15:44:07,750 INFO [spring-startup] c.a.s.i.s.g.m.DefaultSidecarManager Sidecar started after 10032ms
2022-12-25 15:44:09,802 WARN [spring-startup] o.s.w.c.s.XmlWebApplicationContext Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contentTypeResolver' defined in URL [jar:file:/opt/atlassian/bitbucket/8.6.1/app/WEB-INF/lib/bitbucket-platform-8.6.1.jar!/com/atlassian/stash/internal/plugin/SimpleContentTypeResolver.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.atlassian.stash.internal.plugin.SimpleContentTypeResolver]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport
2022-12-25 15:44:09,810 WARN [spring-startup] o.s.c.a.CommonAnnotationBeanPostProcessor Destroy method on bean with name 'meshController' threw an exception: java.lang.NullPointerException: Listener ID should not be null!
2022-12-25 15:44:10,468 INFO [spring-startup] c.a.s.i.s.g.m.DefaultSidecarManager Sidecar has stopped (Exit code: 0)
2022-12-25 15:44:10,518 INFO [spring-startup] c.a.s.internal.home.HomeLockAcquirer Releasing lock on /var/atlassian/application-data/bitbucket/8.6.1/shared
2022-12-25 15:44:10,834 INFO [spring-startup] c.a.s.internal.home.HomeLockAcquirer Releasing lock on /var/atlassian/application-data/bitbucket/8.6.1
2022-12-25 15:44:10,839 ERROR [spring-startup] c.a.j.s.w.s.JohnsonDispatcherServlet SpringMVC dispatcher [springMvc] could not be started
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contentTypeResolver' defined in URL [jar:file:/opt/atlassian/bitbucket/8.6.1/app/WEB-INF/lib/bitbucket-platform-8.6.1.jar!/com/atlassian/stash/internal/plugin/SimpleContentTypeResolver.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.atlassian.stash.internal.plugin.SimpleContentTypeResolver]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1334)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583)
at javax.servlet.GenericServlet.init(GenericServlet.java:158)
at java.base/java.lang.Thread.run(Unknown Source)
... 16 frames trimmed
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.atlassian.stash.internal.plugin.SimpleContentTypeResolver]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:224)
... 5 common frames omitted
Caused by: java.lang.NoClassDefFoundError: com/sun/activation/registries/LogSupport
at javax.activation.MimetypesFileTypeMap.<init>(MimetypesFileTypeMap.java:130)
at javax.activation.MimetypesFileTypeMap.<init>(MimetypesFileTypeMap.java:301)
at com.atlassian.stash.internal.plugin.SimpleContentTypeResolver.<init>(SimpleContentTypeResolver.java:25)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:211)
... 5 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.sun.activation.registries.LogSupport
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown Source)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown Source)
... 12 common frames omitted
2022-12-25 15:44:10,892 WARN [http-nio-7990-exec-5] c.a.j.s.w.f.BypassableDelegatingFilterProxy Bypassing [hazelcastFilter]; no Spring WebApplicationContext is available
```

comments: author: Gonchik Tsymzhitov
body: java 8


Tags: bitbucket-server

server