handshake failure - okhttp uses DefaultSSLSocketFactory

1,119 views
Skip to first unread message

prin...@googlemail.com

unread,
Jan 27, 2016, 10:05:24 AM1/27/16
to SonarQube
I'm trying to connect to a remote server behind a proxy

mvn clean verify org.codehaus.mojo:sonar-maven-plugin::sonar -Dsonar.host.url=https://abc.de

and I get the following error

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar (default-cli) on project xyz: Fail to download libraries from server: Received fatal alert: handshake_failure

Java-version: 8.0.72
SonarQube version: 5.3

The only way I could get it to work was to set -Djava.version=1.7., because then a customized SSLsocketFactory will be created in OkHttpClientFactory (SonarQube and SonarRunner) . Without that  okhttp uses the DefaultSSLSocketFactory and a DummyX509KeyManager.

Do you have any idea why is that or is it a bug?

Thanks a lot,
Tobias

StackTrace
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.0.1:sonar (default-cli) on project xyz: Fail to download libraries from server
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:497)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
Caused by: org.apache.maven.plugin.MojoExecutionException: Fail to download libraries from server
        at org.sonarsource.scanner.maven.bootstrap.ExceptionHandling.handle(ExceptionHandling.java:36)
        at org.sonarsource.scanner.maven.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:81)
        at org.sonarsource.scanner.maven.SonarQubeMojo.execute(SonarQubeMojo.java:112)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        ... 19 more
Caused by: java.lang.IllegalStateException: Fail to download libraries from server
        at org.sonar.runner.impl.Jars.downloadFiles(Jars.java:93)
        at org.sonar.runner.impl.Jars.download(Jars.java:70)
        at org.sonar.runner.impl.JarDownloader.download(JarDownloader.java:40)
        at org.sonar.runner.impl.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:91)
        at org.sonar.runner.impl.IsolatedLauncherFactory$1.run(IsolatedLauncherFactory.java:87)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.sonar.runner.impl.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:87)
        at org.sonar.runner.impl.IsolatedLauncherFactory.createLauncher(IsolatedLauncherFactory.java:83)
        at org.sonar.runner.api.EmbeddedRunner.doStart(EmbeddedRunner.java:249)
        at org.sonar.runner.api.EmbeddedRunner.start(EmbeddedRunner.java:187)
        at org.sonar.runner.api.EmbeddedRunner.start(EmbeddedRunner.java:182)
        at org.sonarsource.scanner.maven.bootstrap.RunnerBootstrapper.execute(RunnerBootstrapper.java:60)
        ... 22 more
Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
        at sun.security.ssl.Alerts.getSSLException(Alerts.java:192)
        at sun.security.ssl.Alerts.getSSLException(Alerts.java:154)
        at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:2023)
        at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1125)
        at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
        at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
        at org.sonar.runner.okhttp.Connection.connectTls(Connection.java:239)
        at org.sonar.runner.okhttp.Connection.connectSocket(Connection.java:201)
        at org.sonar.runner.okhttp.Connection.connect(Connection.java:172)
        at org.sonar.runner.okhttp.Connection.connectAndSetOwner(Connection.java:358)
        at org.sonar.runner.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:117)
        at org.sonar.runner.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:329)
        at org.sonar.runner.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:246)
        at org.sonar.runner.okhttp.Call.getResponse(Call.java:276)
        at org.sonar.runner.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:234)
        at org.sonar.runner.okhttp.Call.getResponseWithInterceptorChain(Call.java:196)
        at org.sonar.runner.okhttp.Call.execute(Call.java:79)
        at org.sonar.runner.impl.ServerConnection.callUrl(ServerConnection.java:184)
        at org.sonar.runner.impl.ServerConnection.downloadString(ServerConnection.java:121)
        at org.sonar.runner.impl.ServerConnection.tryServerFirst(ServerConnection.java:148)
        at org.sonar.runner.impl.ServerConnection.download(ServerConnection.java:112)
        at org.sonar.runner.impl.Jars.downloadFiles(Jars.java:78)
        ... 33 more
[ERROR]
[ERROR]

nicolas...@sonarsource.com

unread,
Jan 27, 2016, 10:19:59 AM1/27/16
to SonarQube, prin...@googlemail.com
Hi Tobias,

Can you set -Djavax.net.debug=all and reproduce the issue ? This will enable verbose SSL logging, showing what's causing the handshake failure. It's going to be pretty verbose so I suggest you attach the full output as a file.

Thanks,
Nicolas

nicolas...@sonarsource.com

unread,
Jan 29, 2016, 4:49:05 AM1/29/16
to SonarQube, prin...@googlemail.com
You can also look at SSL debugs on the server side and correlate that with client side behaviour/logs.

Also note that known issues with HTTPS authentication (e.g. client-certificate validation) have been fixed in SonarQube 5.3 (see SONAR-7047 ).

Please post your replies on this thread, this is a community group.

Thanks,
Nicolas
Reply all
Reply to author
Forward
0 new messages