<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Not able to connect splunk using java sdk in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-splunk-using-java-sdk/m-p/559042#M9965</link>
    <description>&lt;P&gt;Hi team,&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;i am getting below error while trying to login with splunk using java sdk.&lt;BR /&gt;&lt;BR /&gt;Caused by: javax.net.ssl.SSLException: java.net.SocketException: Connection reset&lt;BR /&gt;Suppressed: java.net.SocketException: Broken pipe (Write failed)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Nilesh067_0-1626075241549.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15036i10779971DA38DEBD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Nilesh067_0-1626075241549.png" alt="Nilesh067_0-1626075241549.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 12 Jul 2021 07:36:17 GMT</pubDate>
    <dc:creator>Nilesh067</dc:creator>
    <dc:date>2021-07-12T07:36:17Z</dc:date>
    <item>
      <title>Not able to connect splunk using java sdk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-splunk-using-java-sdk/m-p/559042#M9965</link>
      <description>&lt;P&gt;Hi team,&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;i am getting below error while trying to login with splunk using java sdk.&lt;BR /&gt;&lt;BR /&gt;Caused by: javax.net.ssl.SSLException: java.net.SocketException: Connection reset&lt;BR /&gt;Suppressed: java.net.SocketException: Broken pipe (Write failed)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Nilesh067_0-1626075241549.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15036i10779971DA38DEBD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Nilesh067_0-1626075241549.png" alt="Nilesh067_0-1626075241549.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 07:36:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-splunk-using-java-sdk/m-p/559042#M9965</guid>
      <dc:creator>Nilesh067</dc:creator>
      <dc:date>2021-07-12T07:36:17Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to connect splunk using java sdk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-splunk-using-java-sdk/m-p/559059#M9966</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/227932"&gt;@Nilesh067&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;In your case it seems that the connection has been closed by the server end of the connection. This could be an issue with the request you are sending or an issue at their end.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Can you please share you&amp;nbsp;sample code to reproduce the same issue?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;KV&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 10:18:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-splunk-using-java-sdk/m-p/559059#M9966</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-07-12T10:18:56Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to connect splunk using java sdk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-splunk-using-java-sdk/m-p/559064#M9967</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127939"&gt;@kamlesh_vaghela&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;SPAN&gt;ServiceArgs loginArgs &lt;/SPAN&gt;= &lt;SPAN&gt;new &lt;/SPAN&gt;ServiceArgs();&lt;BR /&gt;&lt;SPAN&gt;loginArgs&lt;/SPAN&gt;.setUsername(&lt;SPAN&gt;"uname"&lt;/SPAN&gt;);&lt;BR /&gt;&lt;SPAN&gt;loginArgs&lt;/SPAN&gt;.setPassword(&lt;SPAN&gt;"xx"&lt;/SPAN&gt;);&lt;BR /&gt;&lt;SPAN&gt;loginArgs&lt;/SPAN&gt;.setHost(&lt;SPAN&gt;"myhost"&lt;/SPAN&gt;);&lt;BR /&gt;&lt;SPAN&gt;loginArgs&lt;/SPAN&gt;.setPort(&lt;SPAN&gt;8089&lt;/SPAN&gt;);&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// Create a Service instance and log in with the argument map&lt;BR /&gt;&lt;/SPAN&gt;&lt;SPAN&gt;Service service &lt;/SPAN&gt;= &lt;SPAN&gt;Service&lt;/SPAN&gt;.&lt;SPAN&gt;connect&lt;/SPAN&gt;(&lt;SPAN&gt;serviceArgs&lt;/SPAN&gt;);&lt;BR /&gt;&lt;SPAN&gt;for &lt;/SPAN&gt;(&lt;SPAN&gt;User user &lt;/SPAN&gt;: &lt;SPAN&gt;service&lt;/SPAN&gt;.getUsers().values())&lt;BR /&gt;    &lt;SPAN&gt;System&lt;/SPAN&gt;.&lt;SPAN&gt;out&lt;/SPAN&gt;.println(&lt;SPAN&gt;user&lt;/SPAN&gt;.getName());&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Jul 2021 10:41:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-splunk-using-java-sdk/m-p/559064#M9967</guid>
      <dc:creator>Nilesh067</dc:creator>
      <dc:date>2021-07-12T10:41:43Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to connect splunk using java sdk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-splunk-using-java-sdk/m-p/559066#M9968</link>
      <description>&lt;P&gt;You can try and set a different SSL protocol, the default protocol in Java is not suitable for connection with Splunk:&lt;/P&gt;&lt;PRE&gt;HttpService.&lt;SPAN&gt;setSslSecurityProtocol&lt;/SPAN&gt;(SSLSecurityProtocol.&lt;SPAN&gt;TLSv1_2&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Edit:&lt;/P&gt;&lt;P&gt;Example code - just add the line somewhere that Java will execute it first before Service connection:&lt;/P&gt;&lt;PRE&gt;HttpService.&lt;SPAN&gt;setSslSecurityProtocol&lt;/SPAN&gt;(SSLSecurityProtocol.&lt;SPAN&gt;TLSv1_2&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;ServiceArgs loginArgs = &lt;SPAN&gt;new &lt;/SPAN&gt;ServiceArgs()&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;loginArgs.setUsername(&lt;SPAN&gt;user&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;loginArgs.setPassword(&lt;SPAN&gt;password&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;loginArgs.setHost(&lt;SPAN&gt;host&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;BR /&gt;&lt;/SPAN&gt;loginArgs.setPort(&lt;SPAN&gt;port&lt;/SPAN&gt;)&lt;SPAN&gt;;&lt;/SPAN&gt;&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 10:53:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-splunk-using-java-sdk/m-p/559066#M9968</guid>
      <dc:creator>krienstra</dc:creator>
      <dc:date>2021-07-12T10:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: Not able to connect splunk using java sdk</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-splunk-using-java-sdk/m-p/559070#M9969</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/227932"&gt;@Nilesh067&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please try this? It is working for me.&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;import com.splunk.*;

public class App {
    public static void main(String[] args) throws Exception {
        HttpService.setSslSecurityProtocol(SSLSecurityProtocol.TLSv1_2);

        // Create a map of arguments and add login parameters
        ServiceArgs loginArgs = new ServiceArgs();
        loginArgs.setUsername("admin");
        loginArgs.setPassword("admin123");
        loginArgs.setHost("localhost");
        loginArgs.setPort(8089);

        // Create a Service instance and log in with the argument map
        Service service = Service.connect(loginArgs);

        for (User user : service.getUsers().values())
            System.out.println(user.getName());

    }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;BR /&gt;KV&lt;BR /&gt;▄︻̷̿┻̿═━一&lt;BR /&gt;&lt;BR /&gt;If any of my reply helps you to solve the problem Or gain knowledge, an upvote would be appreciated.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jul 2021 11:31:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Not-able-to-connect-splunk-using-java-sdk/m-p/559070#M9969</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-07-12T11:31:46Z</dc:date>
    </item>
  </channel>
</rss>

