Getting Data In

connection refused: What may be the root cause?

rohithshetty
New Member

Hi,

 I am getting Connection refused error, for one of the host. Is it because of firewall issue's? . Please guide me how to go about it? Error log is given below. Please let me know what is the possible solution.

Note: I am connecting splunk from Java(intergrated splunk.jar in my eclipse). For my local server it is connecting. I just need it to query the logs.

java.lang.RuntimeException: Connection refused: connect
at com.splunk.HttpService.send(Unknown Source)
at com.splunk.Service.send(Unknown Source)
at com.splunk.HttpService.post(Unknown Source)
at com.splunk.Service.login(Unknown Source)
at com.splunk.Service.connect(Unknown Source)
at edu.apollogrp.tests.RohithTest.testAttendanceMobileEventForReplyToNewClassMessage(RohithTest.java:168)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
at org.testng.TestRunner.privateRun(TestRunner.java:767)
at org.testng.TestRunner.run(TestRunner.java:617)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:291)
at org.testng.SuiteRunner.run(SuiteRunner.java:240)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1197)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1122)
at org.testng.TestNG.run(TestNG.java:1030)
at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:111)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:204)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:175)

Tags (1)
0 Karma

rajamummidi
Engager

I faced the same problem when i was trying to access my Splunk enterprise. In order to make it work, please ensure
1. verify whether you use correct management port (default management port is 8089)
2. If you run on Java 8, need to change SSLSecurityPortocol to TLSv1_2

import these classes:

import com.splunk.HttpService;
import com.splunk.SSLSecurityProtocol;

example

HttpService.setSslSecurityProtocol( SSLSecurityProtocol.TLSv1_2 );
Map connectionArgs = new HashMap();
connectionArgs.put("host", "localhost");
connectionArgs.put("username", "admin");
connectionArgs.put("password", "changeme");
connectionArgs.put("port", 8089);
connectionArgs.put("scheme", "https");
Service service = Service.connect(connectionArgs);

Neeraj_Luthra
Splunk Employee
Splunk Employee

Hi Rohith,
It does seem like a firewall issue. I suggest trying "telnet $hostname $port" from command line on your local machine and check whether you can talk to it or not. Maybe talk to your IT guys to confirm that the port is indeed open for your machine's IP.

Hope this helps.

-Neeraj.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Monitoring AI Agents with Splunk Observability Cloud

Let’s say I’m running a travel planning AI app in production. A user asks for three concise hotel options in ...

[Puzzles] Solve, Learn, Repeat: Tiling

This puzzle (first published here) is based on finding groups of tessellated tiles (inspired by floor tiles I ...

SOK it to Me: Top 3 Benefits of Using Splunk Operator on Kubernetes that’ll Make ...

    Thursday, July 9, 2026  |  11:00AM–12:00PM PDT Duration: 1 hour (includes Q&A) Managing can feel like a ...