运行 Splunk SDK 示例出现错误:"No appropriate protocol (protocol is disabled or cipher suites are inappropriate)"

Getting errors when running Splunk SDK examples: "No appropriate protocol (protocol is disabled or cipher suites are inappropriate)"

我从网站 (http://dev.splunk.com/sdks) 下载了 Splunk Java SDK 并尝试在 jdk1.8 下 运行 它。0_91 (windows 10) . 但是我越来越例外。我如何让它发挥作用?

"C:\Program Files\Java\jdk1.8.0_91\bin\java" -Didea.launcher.port=7537 "-Didea.launcher.bin.path=C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.1.3\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\Java\jdk1.8.0_91\jre\lib\charsets.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\deploy.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\access-bridge-64.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\cldrdata.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\dnsns.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\jaccess.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\jfxrt.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\localedata.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\nashorn.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\sunec.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\sunjce_provider.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\sunmscapi.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\sunpkcs11.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\ext\zipfs.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\javaws.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\jce.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\jfr.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\jfxswt.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\jsse.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\management-agent.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\plugin.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\resources.jar;C:\Program Files\Java\jdk1.8.0_91\jre\lib\rt.jar;C:\Users\vitalii\Downloads\splunk-sdk-java-1.5.0\out\production\examples;C:\Users\vitalii\Downloads\splunk-sdk-java-1.5.0\out\production\splunk;C:\Users\vitalii\Downloads\splunk-sdk-java-1.5.0\lib\gson-2.2.4.jar;C:\Users\vitalii\Downloads\splunk-sdk-java-1.5.0\lib\opencsv-2.3.jar;C:\Users\vitalii\Downloads\splunk-sdk-java-1.5.0\lib\org-openide-explorer.jar;C:\Users\vitalii\Downloads\splunk-sdk-java-1.5.0\lib\org-openide-util.jar;C:\Users\vitalii\Downloads\splunk-sdk-java-1.5.0\lib\org-openide-nodes.jar;C:\Users\vitalii\Downloads\splunk-sdk-java-1.5.0\lib\org-openide-util-lookup.jar;C:\Users\vitalii\Downloads\splunk-sdk-java-1.5.0\lib\org-openide-awt.jar;C:\Users\vitalii\Downloads\splunk-sdk-java-1.5.0\lib\org-openide-dialogs.jar;C:\Users\vitalii\Downloads\splunk-sdk-java-1.5.0\lib\org-openide-actions.jar;C:\Users\vitalii\Downloads\splunk-sdk-java-1.5.0\lib\org-openide-filesystems.jar;C:\Users\vitalii\Downloads\splunk-sdk-java-1.5.0\out\production\util;C:\Users\vitalii\Downloads\splunk-sdk-java-1.5.0\lib\commons-cli-1.2.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA Community Edition 2016.1.3\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain com.splunk.examples.search.Program "index=alpo-dev 12345"
java.lang.RuntimeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
    at com.splunk.HttpService.send(HttpService.java:409)
    at com.splunk.Service.send(Service.java:1293)
    at com.splunk.HttpService.post(HttpService.java:308)
    at com.splunk.Service.login(Service.java:1122)
    at com.splunk.Service.login(Service.java:1101)
    at com.splunk.Service.connect(Service.java:187)
    at com.splunk.examples.search.Program.run(Program.java:117)
    at com.splunk.examples.search.Program.main(Program.java:54)
    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:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
Caused by: javax.net.ssl.SSLHandshakeException: No appropriate protocol (protocol is disabled or cipher suites are inappropriate)
    at sun.security.ssl.Handshaker.activate(Handshaker.java:503)
    at sun.security.ssl.SSLSocketImpl.kickstartHandshake(SSLSocketImpl.java:1482)
    at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1351)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403)
    at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387)
    at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559)
    at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1283)
    at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1258)
    at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250)
    at com.splunk.HttpService.send(HttpService.java:403)
    ... 12 more

Process finished with exit code 1

实际上我先尝试了 C# SDK,但我遇到了异常 "The request was aborted: Could not create SSL/TLS secure channel"

示例应用程序的代码在这里:https://github.com/splunk/splunk-sdk-java/blob/master/examples/com/splunk/examples/search/Program.java

我能够通过在文件 C:\Program Files\Java\jdk1.8.0_91\jre\lib\security\java.security:

中注释一行来解决这个问题
# jdk.tls.disabledAlgorithms=SSLv3, RC4, MD5withRSA, DH keySize < 768

您也可以像这样通过覆盖 SSL 安全协议来解决它。

HttpService.setSslSecurityProtocol(SSLSecurityProtocol.TLSv1_2);

此处有更多详细信息 - https://answers.splunk.com/answers/209379/no-appropriate-protocol-protocol-is-disabled-or-ci.html

此异常是由于 Java SSL 和 Splunk SSL 配置之间的不兼容而引发的。 Java8默认不支持SSLV3,但是Splunk支持SSLV3。

解决方案是:

a) 在 Splunk 中更改 HttpService Class b) 在 java.security 包中注释 SSL 配置行。 c) 覆盖 HttpService Class 的方法以使用 SSLv2 版本。

有关更多详细信息,请查看下面给出的 link。 https://answers.splunk.com/answers/209379/no-appropriate-protocol-protocol-is-disabled-or-ci.html