Splunk Cloud Platform

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

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();


// 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!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

 (view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...