Trying to connect Datasift with API key using JAVA code


I have got trial license and tried to connect with Datasift API key for tumblr. But am not able to make a connection. Am getting an error. Please help me clearing the error.


Exception in thread "main" java.lang.NoClassDefFoundError: io/higgs/http/client/HttpRequestBuilder
    at com.datasift.client.DataSiftConfig.<init>(
    at com.datasift.client.DataSiftConfig.<init>(
    at ds.Tumblr.main(
Caused by: java.lang.ClassNotFoundException: io.higgs.http.client.HttpRequestBuilder
    at Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 3 more


package ds;

import com.datasift.client.DataSiftClient;
import com.datasift.client.DataSiftConfig;
import com.datasift.client.core.Stream;

public class Tumblr {
    public static void main(String... args) {
        // TODO: Enter your username and API key
          DataSiftConfig config = new DataSiftConfig("XXXXXXXX", "XXXXXXXXXXXXXXXXXXXXX");
        DataSiftClient datasift = new DataSiftClient(config);

        try {
            // Compile filter looking for mentions of brands
            String csdl = "interaction.content contains_any \"Calvin Klein, GQ, Adidas\"";
            Stream stream = datasift.compile(csdl).sync();
            datasift.liveStream().onError(new ErrorHandler()); // handles stream errors
             datasift.liveStream().subscribe(new Subscription(Stream.fromString("XXXXXXXXXXX")));
            datasift.liveStream().onStreamEvent(new DeleteHandler()); // handles data deletes

            // Subscribe to the stream
            datasift.liveStream().subscribe(new Subscription(stream));
        catch(Exception ex)
            // TODO: Your exception handling here
    public static class Subscription extends StreamSubscription {
        public Subscription(Stream stream) {

        public void onDataSiftLogMessage(DataSiftMessage di) {
            System.out.println((di.isError() ? "Error" : di.isInfo() ? "Info" : "Warning") + ":\n" + di);

        public void onMessage(Interaction i) {
            System.out.println("Tumblr:\n" + i);

    // Delete handler
    public static class DeleteHandler extends StreamEventListener {
        public void onDelete(DeletedInteraction di) {
            // You must delete the interaction to stay compliant
            System.out.println("DELETED:\n " + di);

    // Error handler
    public static class ErrorHandler extends ErrorListener {
        public void exceptionCaught(Throwable t) {
            // TODO: do something useful..!


It looks like your problem may be a missing dependency. The class HttpRequestBuilder is part of the HTTP client. it looks like you’re added the data-java.jar to your class path but not the dependencies of the library or at least not the HTTP client dependency.


Thank you for the reply. Am getting the below error after clearing the previous error


Exception in thread "main" java.lang.NoSuchMethodError: io.higgs.http.client.HttpRequestBuilder.isSupportedSSLProtocol(Ljava/lang/String;)Z
    at com.datasift.client.DataSiftConfig.<init>(
    at com.datasift.client.DataSiftConfig.<init>(
    at ds.Tumblr.main(


It’s a little difficult to tell, but it appears that this may still be something to do with incompatible dependencies, and the version of the HTTP client you’re using being older than the one we require in the client.

Can you please confirm how you’re setting up your c;ass path? Is it using Maven / Gradle / manually / etc?
Also, where are you getting your dependencies from, and could you please provide a list of all the JARs added to your class path?

Just for your reference, we provide a full list of dependencies at, and the version of the HTTP client we are using is