I've recently upgraded our SonarQube install to version 7.1, and since then the SonarQube Scanner used by Jenkins is failing.
- SonarQube: Version 7.1 (build 11001)
- SonarQube Scanner: 3.1.0.1141
- SonarQube Scanner for Jenkins (plugin): 2.7.1
- Jenkins: 2.117
The issue occurs when the Scanner tries to download the sonar-scanner-engine-shaded-7.1-all.jar from the SonarQube installation. I know that the .jar download works okay as I've hit the REST endpoint manually (http://<SONARQUBE_INSTALLATION>/batch/file?name=sonar-scanner-engine-shaded-7.1-all.jar) and downloaded it locally. The Scanner however seems to be having difficulty decoding the file stream, as seen in the stack trace:
17:08:25.407 ERROR: Error during SonarQube Scanner execution
org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:85)
at java.security.AccessController.doPrivileged(Native Method)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:74)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:70)
at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:167)
at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:113)
at org.sonarsource.scanner.cli.Main.execute(Main.java:73)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalStateException: Fail to download sonar-scanner-engine-shaded-7.1-all.jar to C:\Windows\system32\config\systemprofile\.sonar\cache\_tmp\fileCache3232399505136835337.tmp
at org.sonarsource.scanner.api.internal.cache.FileCache.download(FileCache.java:100)
at org.sonarsource.scanner.api.internal.cache.FileCache.get(FileCache.java:84)
at org.sonarsource.scanner.api.internal.JarDownloader.lambda$getScannerEngineFiles$0(JarDownloader.java:60)
at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1374)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at org.sonarsource.scanner.api.internal.JarDownloader.getScannerEngineFiles(JarDownloader.java:61)
at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:53)
at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.lambda$createLauncher$0(IsolatedLauncherFactory.java:76)
... 7 more
Caused by: java.net.ProtocolException: Expected leading [0-9a-fA-F] character but was 0xe1
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http1.Http1Codec$ChunkedSource.readChunkSize(Http1Codec.java:451)
at org.sonarsource.scanner.api.internal.shaded.okhttp.internal.http1.Http1Codec$ChunkedSource.read(Http1Codec.java:425)
at org.sonarsource.scanner.api.internal.shaded.okio.RealBufferedSource$1.read(RealBufferedSource.java:430)
at java.io.InputStream.read(InputStream.java:101)
at java.nio.file.Files.copy(Files.java:2908)
at java.nio.file.Files.copy(Files.java:3027)
at org.sonarsource.scanner.api.internal.ServerConnection.downloadFile(ServerConnection.java:81)
at org.sonarsource.scanner.api.internal.JarDownloader$ScannerFileDownloader.download(JarDownloader.java:73)
at org.sonarsource.scanner.api.internal.cache.FileCache.download(FileCache.java:98)
... 19 more
I've found the class file which throws this exception and suspect that the shaded jar is corrupt. However, when I download it manually and rename the file, I can access the jar contents without issue.
Has anyone else experienced this issue? Do I need to wait for a fix to the Scanner, or SonarQube installation?
Thanks in advance,
Nick