Bitbucket Data Center not accessible after Java upgrade
Platform Notice: Data Center Only - This article only applies to Atlassian apps 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
Summary
Bitbucket not accessible after Java version upgrade, with error "java.base does not "opens java.lang" to unnamed module" in the logs.
Environment
Bitbucket Data Center
Diagnosis
The Bitbucket applications logs would have the below snippet:
atlassian-bitbucket.log
Caused by: java.lang.ExceptionInInitializerError: Exception com.google.inject.internal.cglib.core.$CodeGenerationException: java.lang.reflect.InaccessibleObjectException-->Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @54b8a6a6 [in thread "spring-startup"]
at com.google.inject.internal.cglib.core.$ReflectUtils.defineClass(ReflectUtils.java:464)Check the options in theJVM_JAVA_ARGSargument. For example, the default values for the JVM_JAVA_ARGS parameter that are included in Bitbucket 8.18.0 are listed below:
Output of "ps -ef | grep java" command
atlbitb+ 4066 1 1 Apr14 ? 00:28:50 /opt/jdk/jdk-11.0.18+10/bin/java -classpath /opt/atlassian/bitbucket/current/app -Datlassian.standalone=BITBUCKET -Dbitbucket.home=/var/atlassian/application-data/bitbucket -Dbitbucket.install=/opt/atlassian/bitbucket/current -Dcom.sun.jndi.ldap.connect.pool.timeout=300000 -Dcom.sun.management.jmxremote.port=3333 -Dcom.sun.management.jmxremote.rmi.port=3333 -Djava.rmi.server.hostname=10.227.163.193 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.password.file=/var/atlassian/bitbucket_jmx.access -Xms4096M -Xmx4096M -XX:+UseG1GC -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Djava.io.tmpdir=/var/atlassian/application-data/bitbucket/tmp -Djava.library.path=/opt/atlassian/bitbucket/current/lib/native;/var/atlassian/application-data/bitbucket/lib/native -XX:+IgnoreUnrecognizedVMOptions --add-opens=java.base/sun.nio.ch=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.naming/com.sun.jndi.ldap=ALL-UNNAMED com.atlassian.bitbucket.internal.launcher.BitbucketServerLauncher startCause
One of the parameters in the JVM_JAVA_ARGSargument could be missing.
Solution
In the
JVM_JAVA_ARGSsection of the "<Bitbucket-Install-Dir>/bin/_start-webapp.sh" file, add the parameter "--add-opens=java.base/java.lang=ALL-UNNAMED"Restart Bitbucket for changes to take effect.
Was this helpful?