[Solved] java.nio.file.AccessDeniedException: sonarqube

When I was trying to launch SonarQube in my windows local system, I found an issue as Error app[][o.s.application.App] Startup failure, java.nio.file.AccessDeniedException: sonarqube\temp\jna..dll. The console window used to close immediately after this issue occurred, and somehow I could manage to get a screenshot of the issue. Here are the complete details of the issue:

Error app[][o.s.application.App] Startup failure
java.nio.file.AccessDeniedException: sonarqube\temp\jna..dll
jvm 1 at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:89)
jvm 1 at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
jvm 1 at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
jvm 1 at java.base/sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:274)
jvm 1 at java.base/sun.nio.fs.AbstractFileSystemProvider.delete(AbstractFileSystemProvider.java:105)
jvm 1 at java.base/sun.nio.file.Files.delete(Files.java:1142)
jvm 1 at org.sonar.application.AppFilesSystem$ClearnTempDirFIleVisitor.visitFile(AppFileSystem.java.121)
jvm 1 at org.sonar.application.AppFilesSystem$ClearnTempDirFIleVisitor.visitFile(AppFileSystem.java.101)
jvm 1 at java.base/sun.nio.file.Files.walkFileTree(Files.java:2725)
jvm 1 at org.sonar.application.AppFilesSystem.createOrCleanTempDirectory(AppFileSystem.java.96)
jvm 1 at org.sonar.application.AppFilesSystem.reset(AppFileSystem.java.62)
jvm 1 at org.sonar.application.App.start(App.java.53)
jvm 1 at org.sonar.application.App.main(App.java.81)
jvm 1 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
jvm 1 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
jvm 1 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesoorImpl.java:43)
jvm 1 at java.base/java.lang.reflect.Method.invoke(Method.java:566)
jvm 1 at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:240)
jvm 1 at java.base.lang.Thread.run(Thread.java:834)

Problem

Issue screenshot

If we see the details of the issue, it clearly says that Access Denied Exception for some temp .dll file. Due to this startup failure occurred when we try to launch the SonarQube server. There may be a chance that temp .dll is opened already with some other program, let’s see how to solve this problem.

Solution

First, try to navigate to the temp folder which we could see in the issue details. Then as they can be temporary files, we can delete all the files and they can create again at the same time we can see where .dll file is being used or opened.

Try to delete temp folder items

When I tried to delete my temp files in the SonarQube folder, I could see a pop-up saying The action can’t be completed because the file is open in Java(TM) Platform SE binary. As I suspected the temp .dll file is opened or used in the Java process.

The action can’t be completed because the file is open in Java(TM) Platform SE binary

Then I had to open Task Manager and close the Java(TM) Platform SE binary process using End Task selection. There can be two Java processes running and we have to close them.

End the task in the Task Manager window

Once after closing the Java processes I could delete temp folder items and then I launched SonarQube server again, and SonarQube was up and running.

SonarQube is up and running

Video Tutorial

Summary

The main problem was here that one of the temp files was opened in the Java process and it was not closed before. Due to that once again when I tried to launch SonarQube, I could not access the same temp file again. To fix this issue I could just stop the Java process directly without deleting temp folder files. But both solutions will work as SonarQube can create them once again. Please share if this solution worked for you or any other solution worked in the comments.

Sreenivasa Rangan TR
Sreenivasa Rangan TR

Software professional with 7+ years of experience in all phases of software development with robust problem-solving skills and proven experience in creating and designing software in a test-driven environment.

Leave a Reply