SonarQube - Unable to load the Wrapper's nativ

2019-07-19 08:20发布

问题:

I'm installing SonarQube v5.0.

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

SonarQube, whether run via StartSonar.bat using Command Prompt as Administrator or as a Windows Service, keeps throwing the following warning:

WARNING - Unable to load the Wrapper's native library 'wrapper.dll'.
      The file is located on the path at the following location but
      could not be loaded:
        C:\sonarqube-5.0.1\bin\windows-x86-64\.\lib\wrapper.dll
      Please verify that the file is readable by the current user
      and that the file has not been corrupted in any way.
      One common cause of this problem is running a 32-bit version
      of the Wrapper with a 64-bit version of Java, or vica versa.
      This is a 32-bit JVM.
      Reported cause:
        C:\sonarqube-5.0.1\bin\windows-x86-64\lib\wrapper.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform
      System signals will not be handled correctly.

The only info that I've found on the web is some JIRA's from 2010 that don't really help me. I can't create a sonar user on this Windows installation. All my other tools in my CI environment are running on Java 1.8 64-bit, which means that JAVA_HOME is set to JDK 1.8 64-bit. I really don't want to have to run Java 32-bit and the 32-bit Wrapper. That means that the JRE bin/java path at the top of wrapper.conf will have to specify the 32-bit JRE.

What can I do to get rid of this warning?

回答1:

Not all applications use JAVA_HOME variable, so you can have JAVA_HOME pointing on your 64 bits version while you are using a 32 bits. Note: the 'Java_Home' key in the registry is not the JAVA_HOME variable.

Well, one way to be sure is to uninstall the current service, with ..\windows-x86-64\UninstallNTService.bat and install the 32 bits version with ..\windows-x86-32\InstallNTService.bat.

If it works, you definitively have a 32 bits JVM.



回答2:

Installed the service SonarQube in \sonarqube-5.1.2\bin\windows-x86-64.

I just went to the SonarQube in the Windows Services-->go to properties-->Log On tab--->select 'Local Service'(Entered the system password). Thats it!

Issue was resolved.

Hope this helps someone who was not able to resolve from the above posts.



回答3:

I experienced the same problem with SonarQube 5.6.4 on Windows 7. Editing the sonar.properties file to add a wrapper.java.command=... had no effect. Editing my path statement did the trick, though.

The first two folders in my path statement had been

C:\ProgramData\Oracle\Java\javapath;C:\dev\sdks\jdk1.8.0_112\bin;....

The java.exe in the first (C:\ProgramData\Oracle\Java\javapath) is 32-bit. I just switched the two in my path:

C:\dev\sdks\jdk1.8.0_112\bin;C:\ProgramData\Oracle\Java\javapath;...

Suddenly SonarQube started using the 64-bit java.exe in C:\dev\sdks\jdk1.8.0_112\bin

After making this change, I was able to restart Firefox without any difficulty.



回答4:

In my case, running on SonarQube 7.3 on window 7 or window 10, I have to update Java version to java 8 to pass this error.