2 Replies Latest reply on Jun 2, 2020 3:12 AM by Nitesh29

    vROps 8.1: ResourcesClient's lookupResources(ResourceQuery, PageInfo) method throwing unauthorized exception.

    Nitesh29 Lurker

      Hi,

       

      We are trying to get the resources of another instance from one instance. And for that, we are using ResourcesClient object, the client is built like:

       

      ResourcesClient client = ClientConfig.builder()

      .basicAuth(credentialConfig.getUserName(), credentialConfig.getPassword())

      .serverUrl("https://localhost/suite-api")

      .build().newClient()

      .resourcesClient();

       

      And we are using the lookupResources(ResourceQuery, PageInfo) method to get the another instance's resources.
      This code is working fine in vROps version 7.0, 7.5, and 8.0. But the same code is throwing Unauthorized exception in vROps 8.1 version, on the line where
      client.lookupResources(ResourceQuery, PageInfo) method is called.

       

      The error log:

      [2147] 2020-06-02T01:38:51,432 ERROR [Collector worker thread 9] (248) onCollect - Exception in onCollect-

      [2148] com.vmware.ops.api.client.exceptions.AuthException: Unauthorized

      [2149] at com.vmware.ops.api.client.internal.ResponseHandlerImpl.handleResponse(ResponseHandlerImpl.java:97) ~[vcops-suiteapi-client-1.12.jar:?]

      [2150] at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:222) ~[httpclient-4.5.jar:4.5]

      [2151] at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:164) ~[httpclient-4.5.jar:4.5]

      [2152] at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:139) ~[httpclient-4.5.jar:4.5]

      [2153] at com.vmware.ops.api.client.internal.RestClientProxy.execute(RestClientProxy.java:489) ~[vcops-suiteapi-client-1.12.jar:?]

      [2154] at com.vmware.ops.api.client.internal.RestClientProxy.invoke(RestClientProxy.java:260) ~[vcops-suiteapi-client-1.12.jar:?]

      [2155] at com.vmware.ops.api.client.internal.DefaultClient$InvocationHandlerWrapper.invoke(DefaultClient.java:308) ~[vcops-suiteapi-client-1.12.jar:?]

      [2156] at com.sun.proxy.$Proxy127.lookupResources(Unknown Source) ~[?:?]

       

       

       

      Any help on this is appreciated.

       

      Thanks,

      -Nitesh