Uploaded image for project: 'Bitbucket Data Center'
  1. Bitbucket Data Center
  2. BSERV-14036

Bitbucket fails to start when connected to external LDAP on Java 17

    XMLWordPrintable

Details

    Description

      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

      1. Install Java 17 on your instance and make it your default Java version.
      2. Install a Bitbucket 8.8+ instance and make sure it is using Java 17 binary.
      3. Connect it to an external LDAP directory.
      4. 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"
      

      Attachments

        Activity

          People

            mgoyal2@atlassian.com Manish
            ce91f45cf510 Karthik Mahesh
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: