Getting Data In

how to login into remote server . java sdk not able to parse xml file properly

rohtashpoonia
New Member

i am getting this error :

[Fatal Error] :1:1: Premature end of file.
Exception in thread "main" com.splunk.HttpException: HTTP 404 --

<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="shortcut icon" href="/en-US/static/@172409/img/favicon.ico" />
<title>The path '/en-US/services/auth/login' was not found. - Splunk</title>
<style>

    *       { margin: 0; padding: 0; }
    body    { font-family: helvetica, arial, sans-serif; color: #333; padding: 20px; }
    p,pre   { margin-bottom: 1em; font-size: .8em; }
    .status { font-size: .7em; color: #999; margin-bottom: 1em; }
    .msg    { margin-bottom: 1em; font-size: 1.4em;}
    pre     { font-family: Monaco,Courier Bold,Courier New,monospace; font-size: .7em;background-color: #eee;  padding: 5px;}
    #toggle { font-size: .8em; margin-bottom: 1em; }
    .byline { color: #555; }
    .byline span { font-weight: bold; line-height: 1.4em; }
    hr      { height: 1px; background-color: #ccc; border: 0; margin: 20px 0 10px; }
    h2      { font-size: 1em; margin-bottom: 1em; }
    table   { border-collapse: collapse; }
    td      { padding: 2px; }
    td.k    { font-family: helvetica, arial, sans-serif; font-weight: bold; }
    #debug  { display: none; }

    #crashes { margin: 20px 0; padding: 10px; border: 1px solid #800; }
    #crashes dt { font-size: 12px; margin-bottom: 5px; }
    #crashes dd { white-space: pre; background: #f2f2f2; padding: 10px; margin-left: 20px; display: none; font: 10px Monaco,Courier Bold,Courier New,monospace; }

</style>
<script>
    function toggle(what) {
        what = document.getElementById(what);
        if (what.style.display == 'block') {
            what.style.display = 'none';
        } else {
            what.style.display = 'block';
        }
    }
</script>


<p class="status">404 Not Found</p>
<p class="homelink"><a href="/">Return to Splunk home page</a></p>
<h1 class="msg">The path '/en-US/services/auth/login' was not found.</h1>







<hr />
<p class="byline">You are using <span>splunk.dotcom.tesco.org</span>, which is connected to splunkd <span>@172409</span> at <span>https://127.0.0.1:8089</span> on <span>Sun Oct 26 12:31:15 2014</span>.</p>




at com.splunk.HttpException.create(HttpException.java:84)
at com.splunk.HttpService.send(HttpService.java:387)
at com.splunk.Service.send(Service.java:1270)
at com.splunk.HttpService.post(HttpService.java:244)
at com.splunk.Service.login(Service.java:1099)
at com.splunk.Service.login(Service.java:1079)
at com.splunk.Service.connect(Service.java:183)
at com.test.SplunkLogin.main(SplunkLogin.java:13)
Tags (2)
0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Good point, retagged.

martin_mueller
SplunkTrust
SplunkTrust

Looks to me as if you're trying to make REST calls on the Splunk Web port (8000 by default) rather than on the Splunk Management port (8089 by default).

martin_mueller
SplunkTrust
SplunkTrust

What does "working" mean?

If you're getting the regular login interface for Splunk Web then we're back at my original answer, you're trying to make REST calls against the Splunk Web port rather than the Splunk Management port.

Also note, Splunk Management is HTTPS by default while Splunk Web is HTTP by default, further cementing my feeling that you're mixing up the ports.

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Okay, point your browser at this secret port using HTTP and HTTPS and see what happens.

By the way, if you're that secretive you may want to edit out your company name from the error message in the question.

0 Karma

rohtashpoonia
New Member

i tried with http://hostname:portno but its not working . but http://hostname simply working
wat should i do now

Thanks a lot for Helping

0 Karma

rohtashpoonia
New Member

i cant tell its company related

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

What port are you connecting to?

0 Karma

rohtashpoonia
New Member

i can' tell port no its some company server port . have you tried with remote server?

0 Karma

rohtashpoonia
New Member

i am not accessing local host. i am using splunk_java_sdk_1.3.1 to connect to hosted splunk on my server and port number used as my hosting server using .
and using below code to connect
ServiceArgs loginArgs = new ServiceArgs();
loginArgs.setUsername("username");
loginArgs.setPassword("password");
loginArgs.setHost("splunk.comops.xyz.abc.org");
loginArgs.setPort(port);

    Service service = Service.connect(loginArgs);

    for (Application app : service.getApplications().values()) {
        System.out.println(app.getName());
    }

can you provide me working sdk so i can work on it to develop an android app

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...