Sonar, java, certificates

Hello dear friends,

I’m close to a nervous attack! LOL.

I’m trying for some days run a Sonarqube against a java project, using team city as a build server. We try some trivial problems, using a switch to specify a path for certificates and import the certificate for Sonarqube portal on java cacerts using keytool.exe.

Can anyone help with some new ideas?

[18:59:10] [Step 4/4] 18:59:10.378 DEBUG: keyStore is :
[18:59:10] [Step 4/4] 18:59:10.378 DEBUG: keyStore type is : jks
[18:59:10] [Step 4/4] 18:59:10.378 DEBUG: keyStore provider is :
[18:59:10] [Step 4/4] 18:59:10.378 DEBUG: init keystore
[18:59:10] [Step 4/4] 18:59:10.379 DEBUG: init keymanager of type SunX509
[18:59:10] [Step 4/4] 18:59:10.601 INFO: User cache: C:\Users\takemts.sonar\cache
[18:59:10] [Step 4/4] 18:59:10.602 DEBUG: Extract sonar-scanner-api-batch in temp…
[18:59:10] [Step 4/4] 18:59:10.616 DEBUG: Get bootstrap index…
[18:59:10] *[Step 4/4] 18:59:10.616 DEBUG: Download: https://************/batch/index
[18:59:11] [Step 4/4] 18:59:11.036 INFO: ------------------------------------------------------------------------
[18:59:11] [Step 4/4] 18:59:11.036 ERROR: SonarQube server [https://***************] can not be reached
[18:59:11] [Step 4/4] 18:59:11.036 INFO: EXECUTION FAILURE
[18:59:11] [Step 4/4] 18:59:11.036 INFO: ------------------------------------------------------------------------
[18:59:11] [Step 4/4] 18:59:11.036 INFO: Total time: 0.979s
[18:59:11] [Step 4/4] 18:59:11.058 INFO: Final Memory: 4M/61M
[18:59:11] [Step 4/4] 18:59:11.058 ERROR: Error during SonarQube Scanner execution
[18:59:11] [Step 4/4] 18:59:11.058 INFO: ------------------------------------------------------------------------
[18:59:11] [Step 4/4] org.sonarsource.scanner.api.internal.ScannerException: Unable to execute SonarQube
[18:59:11] [Step 4/4] at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:84)
[18:59:11] [Step 4/4] at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:71)
[18:59:11] [Step 4/4] at java.security.AccessController.doPrivileged(Native Method)
[18:59:11] [Step 4/4] at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:71)
[18:59:11] [Step 4/4] at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:67)
[18:59:11] [Step 4/4] at org.sonarsource.scanner.api.EmbeddedScanner.doStart(EmbeddedScanner.java:218)
[18:59:11] [Step 4/4] at org.sonarsource.scanner.api.EmbeddedScanner.start(EmbeddedScanner.java:156)
[18:59:11] [Step 4/4] at org.sonarsource.scanner.cli.Main.execute(Main.java:74)
[18:59:11] [Step 4/4] at org.sonarsource.scanner.cli.Main.main(Main.java:61)
[18:59:11] [Step 4/4] Caused by: java.lang.IllegalStateException: Fail to get bootstrap index from server
[18:59:11] [Step 4/4] at org.sonarsource.scanner.api.internal.Jars.getBootstrapIndex(Jars.java:100)
[18:59:11] [Step 4/4] at org.sonarsource.scanner.api.internal.Jars.getScannerEngineFiles(Jars.java:76)
[18:59:11] [Step 4/4] at org.sonarsource.scanner.api.internal.Jars.download(Jars.java:70)
[18:59:11] [Step 4/4] at org.sonarsource.scanner.api.internal.JarDownloader.download(JarDownloader.java:39)
[18:59:11] [Step 4/4] at org.sonarsource.scanner.api.internal.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:75)
[18:59:11] [Step 4/4] … 8 more
[18:59:11] [Step 4/4] Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

Hello, What java version are you using exactly to run the scanner ?

Hello Pierre,

After I import a certificate to my java jdk1.8.0_92 it works, I mean, this problem with certificate was solved. But now I have a new problem, I think is related to java version and sonar runner.

[09:40:14] [Step 4/4] 09:40:14.378 INFO: Scanner configuration file: D:\TeamCity\BuildAgent\tools\sonar-qube-scanner.3.0.3.778-scanner\conf\sonar-scanner.properties
[09:40:14] [Step 4/4] 09:40:14.401 INFO: Project root configuration file: NONE
** [09:40:14]
** [09:40:14]
[09:40:14] [Step 4/4] 09:40:14.438 INFO: Windows Server 2012 R2 6.3 amd64
[09:40:14] [Step 4/4] 09:40:14.739 DEBUG: keyStore is :
[09:40:14] [Step 4/4] 09:40:14.739 DEBUG: keyStore type is : jks
[09:40:14] [Step 4/4] 09:40:14.739 DEBUG: keyStore provider is :
[09:40:14] [Step 4/4] 09:40:14.739 DEBUG: init keystore
[09:40:14] [Step 4/4] 09:40:14.741 DEBUG: init keymanager of type SunX509
[09:40:15] [Step 4/4] 09:40:14.937 INFO: User cache: C:\Users\takemts.sonar\cache
[09:40:15] [Step 4/4] 09:40:14.938 DEBUG: Extract sonar-scanner-api-batch in temp…
[09:40:15] [Step 4/4] 09:40:14.965 DEBUG: Get bootstrap index…
[09:40:15] [Step 4/4] 09:40:14.965 DEBUG: Download: https://*************/batch/index
[09:40:15] [Step 4/4] 09:40:15.500 DEBUG: Get bootstrap completed
[09:40:15] [Step 4/4] 09:40:15.510 DEBUG: Download https://*************/batch/file?name=scanner-enterprise-8.1.0.31237-all.jar to C:\Users\takemts.sonar\cache_tmp\fileCache6015047261473704023.tmp
[09:40:16] [Step 4/4] 09:40:16.741 DEBUG: Create isolated classloader…
[09:40:16] [Step 4/4] 09:40:16.788 DEBUG: Start temp cleaning…
[09:40:17] [Step 4/4] 09:40:16.836 DEBUG: Temp cleaning done
[09:40:17] [Step 4/4] 09:40:16.836 DEBUG: Execution getVersion
[09:40:17] [Step 4/4] 09:40:16.842 DEBUG: Execution start
[09:40:17] [Step 4/4] 09:40:16.865 DEBUG: Execution getVersion
[09:40:17] [Step 4/4] 09:40:16.865 INFO: SonarQube server 8.1.0
[09:40:17] [Step 4/4] 09:40:16.865 INFO: Default locale: “en_US”, source code encoding: “windows-1252” (analysis is platform dependent)
[09:40:17] [Step 4/4] 09:40:16.866 DEBUG: Work directory: D:\TeamCity\BuildAgent\work\7e54eb4370ded11d.scannerwork
[09:40:17] [Step 4/4] 09:40:16.866 DEBUG: Execution getVersion
[09:40:17] [Step 4/4] 09:40:16.866 DEBUG: Execution execute
** [09:40:17]

I think now I have to force SonarScanner to use Java11.

I forgot: After SSL fix, the error on log file was:

[09:40:29] [Step 4/4] 09:40:29.544 ERROR: Invalid value of sonar.sources for MessagingHub_BlipDocs

[09:40:29] [Step 4/4] 09:40:29.555 INFO: ------------------------------------------------------------------------

[09:40:29] [Step 4/4] 09:40:29.555 INFO: EXECUTION FAILURE

[09:40:29] [Step 4/4] 09:40:29.555 INFO: ------------------------------------------------------------------------

[09:40:29] [Step 4/4] 09:40:29.555 INFO: Total time: 15.335s

[09:40:29] [Step 4/4] 09:40:29.610 ERROR: Error during SonarQube Scanner execution

[09:40:29] [Step 4/4] 09:40:29.609 INFO: Final Memory: 9M/132M

[09:40:29] [Step 4/4] 09:40:29.610 INFO: ------------------------------------------------------------------------

[09:40:29] [Step 4/4] java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.ProjectLock

[09:40:29] [Step 4/4] at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:65)

[09:40:29] [Step 4/4] at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678)

[09:40:29] [Step 4/4] at org.sonar.core.platform.ComponentContainer.getComponentByType(ComponentContainer.java:281)

[09:40:29] [Step 4/4] at org.sonar.scanner.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:152)

[09:40:29] [Step 4/4] at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:134)

[09:40:29] [Step 4/4] at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:122)

The logs in two part are a little bit confusing. Anyway, Indeed, the scanner require java 11 to run. There is a known issue with JKS certificates with the jdk 11.0.6, that you can solve by generating a new SSL certificate with the pkcs format. Or you can use the jdk 11.0.3

1 Like

Yes! I finally solved it. My build server have many java versions, so I have to apply it on correct one. Thank you Pierre!!