-
Bug
-
Resolution: Fixed
-
Highest
-
8.8.0, 8.9.0
-
2
-
Severity 3 - Minor
-
1
-
Issue Summary
Bitbucket fails to start with 500 internal Server error when connected to external LDAP directory on Java 17
This is reproducible on Data Center: (yes)
Steps to Reproduce
- Install Java 17 on your instance and make it your default Java version.
- Install a Bitbucket 8.8+ instance and make sure it is using Java 17 binary.
- Connect it to an external LDAP directory.
- Restart Bitbucket instance.
Expected Results
Bitbucket should start without issues.
Actual Results
Bitbucket fails to start with 500 internal Server error. Below error is logged in the log file.
2023-04-18 16:21:03,038 ERROR [Caesium-1-3] c.a.scheduler.core.JobLauncher Scheduled job with ID 'com.atlassian.crowd.manager.directory.monitor.DirectoryMonitorRefresherStarter-job' failed due to binary incompatibilities java.lang.IllegalAccessError: class org.springframework.ldap.core.support.AbstractContextSource (in unnamed module @0x58695725) cannot access class com.sun.jndi.ldap.LdapCtxFactory (in module java.naming) because module java.naming does not export com.sun.jndi.ldap to unnamed module @0x58695725 at org.springframework.ldap.core.support.AbstractContextSource.<clinit>(AbstractContextSource.java:77) at com.atlassian.crowd.directory.LdapContextSourceFactory.createContextSource(LdapContextSourceFactory.java:73) at com.atlassian.crowd.directory.LdapContextSourceProvider.getPooledContextSource(LdapContextSourceProvider.java:28) at com.atlassian.crowd.directory.SpringLDAPConnector.getContextSource(SpringLDAPConnector.java:208) at com.atlassian.crowd.directory.SpringLDAPConnector.setAttributes(SpringLDAPConnector.java:184)
2023-04-18 16:21:18,300 INFO [spring-startup] c.a.b.i.s.c.j.c.HealthCheckRunner New health check registered: AuthenticationCheck 2023-04-18 16:21:22,853 ERROR [Caesium-1-1] c.a.scheduler.core.JobLauncher Scheduled job with ID 'com.atlassian.crowd.manager.directory.monitor.DirectoryMonitorRefresherStarter-job' failed due to binary incompatibilities java.lang.NoClassDefFoundError: Could not initialize class org.springframework.ldap.core.support.LdapContextSource at com.atlassian.crowd.directory.LdapContextSourceFactory.createContextSource(LdapContextSourceFactory.java:73) at com.atlassian.crowd.directory.LdapContextSourceProvider.getPooledContextSource(LdapContextSourceProvider.java:28) at com.atlassian.crowd.directory.SpringLDAPConnector.getContextSource(SpringLDAPConnector.java:208) . . 2023-04-18 16:21:24,302 ERROR [http-nio-7990-exec-7] o.a.c.c.C.[.[.[/].[springMvc] Servlet.service() for servlet [springMvc] in context with path [] threw exception [Filter execution threw an exception] with root cause java.lang.NoClassDefFoundError: Could not initialize class org.springframework.ldap.core.support.LdapContextSource
Workaround
As a workaround add the JVM parameter --add-opens=java.naming/com.sun.jndi.ldap=ALL-UNNAMED to the file $BB_INSTALL/bin/_start-webapp.sh and restart Bitbucket. This can be added by default with our installer as a fix.
JVM_SUPPORT_RECOMMENDED_ARGS="--add-opens=java.naming/com.sun.jndi.ldap=ALL-UNNAMED"