0

I am getting Getting URI can't be null when trying with the url

Below is my code,

HttpService.setSslSecurityProtocol(SSLSecurityProtocol.SSLv3);
 //Tried the below one also
 //HttpService.setSslSecurityProtocol(SSLSecurityProtocol.TLSv1_2);

      ServiceArgs loginArgs  = new ServiceArgs();
      loginArgs.setUsername("username");
      loginArgs.setPassword("password");
      loginArgs.setHost("my splunk url"); //for eg http://splunkdet.mysite.com:8000/login
      loginArgs.setPort(8000);

      Service service = Service.connect(loginArgs);

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

Getting Exception "URI can't be null" Service service = Service.connect(loginArgs);

What is wrong with my code?

Gnik
  • 7,120
  • 20
  • 79
  • 129

1 Answers1

0

Since your using http and not https you don't need to use HttpService.setSslSecurityProtocol.

Instead add the scheme to your ServiceArgs example : loginArgs.setScheme("http");

And don't include http:// or https:// in the URL you pass to setHost.

Kevin
  • 1