Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SonarQube - Temp directory is not writable

I'm installing SonarQube v5.0.1.

I'm running Windows Server 2012 64-bit, Java 1.8 64-bit, and the SonarQube windows-x86-64 wrapper.

SonarQube keeps throwing the following error:

WrapperSimpleApp: Encountered an error running main: java.lang.IllegalStateException: Temp directory is not writable: C:\Windows\system32\config\systemprofile\AppData\Local\Temp\
java.lang.IllegalStateException: Temp directory is not writable: C:\Windows\system32\config\systemprofile\AppData\Local\Temp\
    at org.sonar.process.MinimumViableSystem.checkWritableDir(MinimumViableSystem.java:60)
    at org.sonar.process.MinimumViableSystem.checkWritableTempDir(MinimumViableSystem.java:52)
    at org.sonar.process.MinimumViableSystem.check(MinimumViableSystem.java:45)
    at org.sonar.application.App.main(App.java:113)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
    at java.lang.Thread.run(Unknown Source)
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)
    ... 9 more
<-- Wrapper Stopped

Why does SonarQube keep trying to write to C:\Windows\System32\config\systemprofile\AppData\Local instead of C:\Windows\SysWOW64\config\systemprofile\AppData\Local?

To get rid of this error in previous installations, I've had to create a Temp folder in C:\Windows\System32\config\systemprofile\AppData\Local and fiddle with the read/write settings and or permissions to get SonarQube to stop complaining.

UPDATE: This is a huge problem, because I can't start SonarQube as a Windows Service. What's weird is that I already had SonarQube installed and running as a Windows Service. Today, I stopped the service, and now I can't start the service anymore. I've set the Temp folder's permissions to be not Read-Only and so that Everyone has Full Control (not ideal, I know...)

Still, the Temp error prevents SonarQube from starting.

like image 489
Chris Harris Avatar asked Mar 12 '15 20:03

Chris Harris


3 Answers

This can also be fixed by setting the java.io.tmpdir java property to a writable directory. e.g., in conf/wrapper.conf change

wrapper.java.additional.1=-Djava.awt.headless=true

to

wrapper.java.additional.1=-Djava.awt.headless=true -Djava.io.tmpdir=E:/sonarqube-5.1/temp
like image 79
Tom Howard Avatar answered Nov 04 '22 16:11

Tom Howard


I had the same error in my sonar log when trying to start the service after I had installed it.

I had JAVA_HOME and x64 all correctly set up.

I managed to resolve the issue in the log above by changing the 'Log On As' for the installed service to 'NETWORK SERVICE' (without a password), then started the service. By default it had set the Log On As to Local System.

Probably another thing worth mentioning is if you're setting up SonarQube for the first time it may be best to get the website working before installing the service, otherwise debugging is a bit of a pain.

like image 20
Sean Tomlins Avatar answered Nov 04 '22 16:11

Sean Tomlins


Same as previous message SonarQube - Unable to load the Wrapper's native library 'wrapper.dll': can you verify that you have a Java 64 bits installed, because it looks as 32 bits version.

like image 1
Qualilogy Avatar answered Nov 04 '22 16:11

Qualilogy