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!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Modernize your Splunk Apps – Introducing Python 3.13 in Splunk

We are excited to announce that the upcoming releases of Splunk Enterprise 10.2.x and Splunk Cloud Platform ...

Step into “Hunt the Insider: An Splunk ES Premier Mystery” to catch a cybercriminal ...

After a whole week of being on call, you fell asleep on your keyboard, and you hit a sequence of buttons that ...