3

I downloaded Splunk Java SDK from website (http://dev.splunk.com/sdks) and trying to run it under jdk1.8.0_91 (windows 10). However I am getting exception. How do I make it work?

"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

Actuall I tried C# SDK first but I got the exception "The request was aborted: Could not create SSL/TLS secure channel"

The code of the example application is here: https://github.com/splunk/splunk-sdk-java/blob/master/examples/com/splunk/examples/search/Program.java

vmg
  • 9,920
  • 13
  • 61
  • 90

3 Answers3

6

You can also resolve it by overriding SSL Security protocol like this.

HttpService.setSslSecurityProtocol(SSLSecurityProtocol.TLSv1_2);

More details here - https://answers.splunk.com/answers/209379/no-appropriate-protocol-protocol-is-disabled-or-ci.html

Shankar
  • 2,625
  • 3
  • 25
  • 49
  • You can also see the [`ssl_protocols`](https://github.com/splunk/splunk-sdk-java/blob/master/examples/com/splunk/examples/ssl_protocols/Program.java) example for how to use other versions of TLS – Shakeel Jun 27 '16 at 14:49
4

I was able to solve this problem by commenting line in file C:\Program Files\Java\jdk1.8.0_91\jre\lib\security\java.security:

# jdk.tls.disabledAlgorithms=SSLv3, RC4, MD5withRSA, DH keySize < 768
vmg
  • 9,920
  • 13
  • 61
  • 90
0

This Exception is thrown due to incompetibility between Java SSL and Splunk SSL configuration. Java 8 do not support SSLV3 by default, but Splunk support SSLV3.

Solution are :

a) Change HttpService Class in Splunk b) Comment SSL configuration line in java.security package. c) override the method of HttpService Class to use SSLv2 version.

For Further details, check out the given below link. https://answers.splunk.com/answers/209379/no-appropriate-protocol-protocol-is-disabled-or-ci.html

mohneesh
  • 1
  • 4