VMware Cloud Community
Nitesh29
Contributor
Contributor
Jump to solution

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

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

1 Solution

Accepted Solutions
RickVerstegen
Expert
Expert
Jump to solution

You are using basic authentication. By default, vRealize Operations Manager 8.1 and later do not allow Basic Authentication for API.

More details check below article:

VMware Knowledge Base

Was I helpful? Give a kudo for appreciation!
Blog: https://rickverstegen84.wordpress.com/
Twitter: https://twitter.com/verstegenrick

View solution in original post

2 Replies
RickVerstegen
Expert
Expert
Jump to solution

You are using basic authentication. By default, vRealize Operations Manager 8.1 and later do not allow Basic Authentication for API.

More details check below article:

VMware Knowledge Base

Was I helpful? Give a kudo for appreciation!
Blog: https://rickverstegen84.wordpress.com/
Twitter: https://twitter.com/verstegenrick
Nitesh29
Contributor
Contributor
Jump to solution

Thanks RickVerstegen,


The Token Authentication with CrednetialRetriever worked.

Reply
0 Kudos