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

BB_INSTALL_DIR\elasticsearch\bin\elasticsearch-env.bat is pointing to the wrong location for Elasticsearch config folder.

    XMLWordPrintable

Details

    Description

      This looks to be a recurrence of BSERV-10746 somehow with the introduction of Elasticsearch 6.5.3 on Bitbucket 6.x

      Summary

      It's not possible to create the Elasticsearch service in Windows – To create the services, one must go over the instructions of the article below, however, it's not possible to create the Elasticsearch service in Windows, since the batch file responsible for creating the service is checking the wrong location.

      https://confluence.atlassian.com/bitbucketserver/running-bitbucket-server-as-a-windows-service-776640048.html/

      How to Replicate

      1. Download the ZIP archive for Bitbucket 6.0/6.1.0
      2. Install it.
      3. Go over the Running Bitbucket Server as a Windows service to create the services;
      4. At step 9 change directory as instructed;
      5. At step 10 run the command below to create the Elasticsearch service
        service.bat install MyName
        
      1. This will result in the following message:
        C:\Atlassian\Bitbucket\6.1.0\elasticsearch\bin>service.bat install BB6_Search
        Installing service      :  "BB6_Search"
        Using JAVA_HOME (64-bit):  "C:\Program Files\Java\jre1.8.0_141"
        Exception in thread "main" java.nio.file.NoSuchFileException: C:\Atlassian\Bitbucket\6.1.0\elasticsearch\config\jvm.options
        

      Expected Results

      Elasticsearch service should be created

      Actual Results

      After running the

      service.bat install MyName

      the following message will be shown and the service won't be created

      Exception in thread "main" java.nio.file.NoSuchFileException: C:\Atlassian\Bitbucket\6.1.0\elasticsearch\config\jvm.options
      

      Notes

      What is causing the issue is that the <Bitbucket Server installation directory>\elasticsearch\bin\elasticsearch-env.bat is pointing to the wrong location while trying to find the jvm-options file.

      In the elasticsearch-env.bat file we can see the following

      if not defined ES_PATH_CONF (
        set ES_PATH_CONF=!ES_HOME!\config
      )
      

      In the code above we can see that it is trying to check for the file in %ES_HOME%\config however, there's no config folder but config-template.

      Workaround

      1. Edit the <Bitbucket Server installation directory>\elasticsearch\bin\elasticsearch-env.bat
      2. replace
        if not defined ES_PATH_CONF (
          set ES_PATH_CONF=!ES_HOME!\config
        )
        
      1. For
        if not defined ES_PATH_CONF (
          set ES_PATH_CONF=!ES_HOME!\config-template
        )
        
      1. run the command in the step 10 of the article again;

      Attachments

        Issue Links

          Activity

            People

              ctan@atlassian.com Cameron Tan (Inactive)
              vchoo Vivian C
              Votes:
              1 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: