<?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 Getting ClassCastException with Service.connect for Splunk sdk Java in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Getting-ClassCastException-with-Service-connect-for-Splunk-sdk/m-p/404194#M6943</link>
    <description>&lt;P&gt;Hi,&lt;BR /&gt;
I am using Splunk sdk for Java to access splunk REST API endpoints. I am trying to call API as per below code:&lt;BR /&gt;
Code Snippet:&lt;BR /&gt;
...&lt;BR /&gt;
Map connectArgs=new HashMap();&lt;BR /&gt;
    connectArgs.put("host", "splunk");&lt;BR /&gt;
    connectArgs.put("username", "username");&lt;BR /&gt;
    connectArgs.put("password", "pass");&lt;BR /&gt;
    connectArgs.put("port", "8089");&lt;BR /&gt;
    connectArgs.put("scheme", "https");&lt;BR /&gt;
Service splunkService=Service.connect(connectArgs);                                  //Line with exception&lt;BR /&gt;
...&lt;/P&gt;

&lt;P&gt;It gives ClassCastException at service call "Service splunkService=Service.connect(connectArgs); ". Please find below for exception log:&lt;BR /&gt;
...&lt;BR /&gt;
Exception in thread "main" java.lang.ClassCastException: java.base/java.lang.String cannot be cast to java.base/java.lang.Integer&lt;BR /&gt;
    at com.splunk.Service.&lt;INIT&gt;(Service.java:166)&lt;BR /&gt;
...&lt;/INIT&gt;&lt;/P&gt;

&lt;P&gt;Is there any dependency needs to be added to avoid exception. Please let me know where is the issue. &lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;</description>
    <pubDate>Fri, 18 May 2018 14:51:37 GMT</pubDate>
    <dc:creator>deepaksplunk201</dc:creator>
    <dc:date>2018-05-18T14:51:37Z</dc:date>
    <item>
      <title>Getting ClassCastException with Service.connect for Splunk sdk Java</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Getting-ClassCastException-with-Service-connect-for-Splunk-sdk/m-p/404194#M6943</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
I am using Splunk sdk for Java to access splunk REST API endpoints. I am trying to call API as per below code:&lt;BR /&gt;
Code Snippet:&lt;BR /&gt;
...&lt;BR /&gt;
Map connectArgs=new HashMap();&lt;BR /&gt;
    connectArgs.put("host", "splunk");&lt;BR /&gt;
    connectArgs.put("username", "username");&lt;BR /&gt;
    connectArgs.put("password", "pass");&lt;BR /&gt;
    connectArgs.put("port", "8089");&lt;BR /&gt;
    connectArgs.put("scheme", "https");&lt;BR /&gt;
Service splunkService=Service.connect(connectArgs);                                  //Line with exception&lt;BR /&gt;
...&lt;/P&gt;

&lt;P&gt;It gives ClassCastException at service call "Service splunkService=Service.connect(connectArgs); ". Please find below for exception log:&lt;BR /&gt;
...&lt;BR /&gt;
Exception in thread "main" java.lang.ClassCastException: java.base/java.lang.String cannot be cast to java.base/java.lang.Integer&lt;BR /&gt;
    at com.splunk.Service.&lt;INIT&gt;(Service.java:166)&lt;BR /&gt;
...&lt;/INIT&gt;&lt;/P&gt;

&lt;P&gt;Is there any dependency needs to be added to avoid exception. Please let me know where is the issue. &lt;/P&gt;

&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Fri, 18 May 2018 14:51:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Getting-ClassCastException-with-Service-connect-for-Splunk-sdk/m-p/404194#M6943</guid>
      <dc:creator>deepaksplunk201</dc:creator>
      <dc:date>2018-05-18T14:51:37Z</dc:date>
    </item>
    <item>
      <title>Re: Getting ClassCastException with Service.connect for Splunk sdk Java</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Getting-ClassCastException-with-Service-connect-for-Splunk-sdk/m-p/558814#M6944</link>
      <description>&lt;P&gt;Does the issues resolved. If yes may i know how. Even i am facing the same issue.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 10:51:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Getting-ClassCastException-with-Service-connect-for-Splunk-sdk/m-p/558814#M6944</guid>
      <dc:creator>gayatri001</dc:creator>
      <dc:date>2021-07-09T10:51:03Z</dc:date>
    </item>
    <item>
      <title>Re: Getting ClassCastException with Service.connect for Splunk sdk Java</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Getting-ClassCastException-with-Service-connect-for-Splunk-sdk/m-p/558824#M6945</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/118465"&gt;@deepaksplunk201&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/236226"&gt;@gayatri001&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think port is Integer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;connectArgs.put("port", 8089);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Check below link for example.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;A href="https://www.programcreek.com/java-api-examples/?code=apache%2Fattic-apex-malhar%2Fattic-apex-malhar-master%2Fcontrib%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fapex%2Fmalhar%2Fcontrib%2Fsplunk%2FSplunkStore.java" target="_blank" rel="noopener"&gt;https://www.programcreek.com/java-api-examples/?code=apache%2Fattic-apex-malhar%2Fattic-apex-malhar-master%2Fcontrib%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fapex%2Fmalhar%2Fcontrib%2Fsplunk%2FSplunkStore.java&lt;/A&gt;&lt;/P&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.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jul 2021 11:32:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Getting-ClassCastException-with-Service-connect-for-Splunk-sdk/m-p/558824#M6945</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-07-09T11:32:49Z</dc:date>
    </item>
  </channel>
</rss>

