Uploaded image for project: 'SonarQube'
  1. SonarQube
  2. SONAR-7154

SonarQube fails to start as a service on recent Windows versions

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.6
    • Component/s: None
    • Labels:

      Description

      On recent versions of Windows, SonarQube fails to start as a service. See the following thread: https://groups.google.com/forum/#!searchin/sonarqube/windows$20service/sonarqube/nl8i7-dtHJg/bPJrJuJ5AQAJ

      The explanation is the following one :

      • Since Windows vista or 2008, by default the value of the Java's temporary directory is "C:\Windows\system32\config\systemprofile\AppData\Local\Temp" when running as a service with the default SYSTEM user. But this directory is locked down. See https://wrapper.tanukisoftware.com/doc/english/prop-java-tmpdir-x.html.
      • This is not an issue for the SonarQube web and ElasticSearch processes because those two java processes are using by default the "${SONARQUBE_HOME}/temp" provided by the "sonar.path.temp" property defined in the conf/sonar.properties file
      • The only process relying on this default temporary directory is the parent one. Even if writing on this temporary directory is impossible, this was not an issue with not so old versions of SQ because anyway nothing is written by the parent process into the temporary directory
      • So what's the issue ? In SQ 5.X, a MinimumViableSystem class is in charge to validate all the environment variables used by the three processes and to fail is one is incorrect. And so that's why this exception is thrown when trying to execute SonarQube as a windows service on recent versions of Windows :
        Caused by: java.io.IOException: The system cannot find the path specified
        	at java.io.WinNTFileSystem.createFileExclusively(Native Method)
        	at java.io.File.createTempFile(Unknown Source)
        	at org.sonar.process.MinimumViableSystem.checkWritableDir(MinimumViableSystem.java:57)
        
      • Adding the following line in the conf/wrapper.conf file should permanently fix this issue :
        wrapper.java.additional.2=-Djava.io.tmpdir=../../temp
        

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              sebastien.lesaint Sebastien Lesaint
              Reporter:
              fabrice.bellingard Fabrice Bellingard
              Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

                Dates

                Due:
                Created:
                Updated:
                Resolved: