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
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...