Splunk Cloud Platform

Facing "An established connection was aborted by your host machine" while connecting to the splunk.

venkatramana
Loves-to-Learn Lots
package org.example;



import com.splunk.HttpService;
import com.splunk.SSLSecurityProtocol;
import com.splunk.Service;
import com.splunk.ServiceArgs;

public class ActualSplunk {
public static void main(String[] args) {
// Create ServiceArgs object with connection parameters
ServiceArgs loginArgs = new ServiceArgs();
loginArgs.setUsername("providedvalidusername");
loginArgs.setPassword("providedvalidpassword");
loginArgs.setHost("hostname");
loginArgs.setPort(8089);

HttpService.setSslSecurityProtocol(SSLSecurityProtocol.TLSv1_2);

// Connect to Splunk
Service service = Service.connect(loginArgs);

// Check if connection is successful
if (service != null) {
System.out.println("Connected to Splunk!");
// Perform operations with the 'service' object as needed
} else {
System.out.println("Failed to connect to Splunk.");
}

// Close the connection when done
if (service != null) {
service.logout(); // Logout from the service
// service.close(); // Close the service connection
}
}
}

when i run the above code to connect to the local splunk it is working fine with my local splunk credentials.
But when i tried same code in my VM with the actual splunk cloud host, username, password to connect to the splunk to get the logs it throwing an exception
"java.lang.RuntimeException:An established connection was aborted by your host machine".

Labels (1)
0 Karma
Get Updates on the Splunk Community!

Index This | Why did the turkey cross the road?

November 2025 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...