Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failure to handle OCI authentication in /bmc-examples/src/main/java/CreateInstanceExample.java #568

Open
ammbra opened this issue Dec 14, 2023 · 0 comments

Comments

@ammbra
Copy link
Member

ammbra commented Dec 14, 2023

Hello,

I tried the example https://github.com/oracle/oci-java-sdk/blob/master/bmc-examples/src/main/java/CreateInstanceExample.java
with the latest SDK version and providing the arguments mentioned by the example. However the example fails with:

SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" com.oracle.bmc.model.BmcException: Error returned by ListAvailabilityDomains operation in Identity service.(401, NotAuthenticated, false) The required information to complete authentication was not provided or was incorrect. (opc-request-id: C936D868CDD14E86ABD33B089FBE87D1/0477CC4974ED912CFA787CE7B4B46A00/1EC18D8155B178BAD7A5AD7E9566F2D7)
Timestamp: 2023-12-14T10:55:18.221Z
Client version: Oracle-JavaSDK/3.31.0
Request Endpoint: https://identity.us-phoenix-1.oci.oraclecloud.com/20160918/availabilityDomains?compartmentId=******************************************************
Troubleshooting Tips: See https://docs.oracle.com/en-us/iaas/Content/API/References/apierrors.htm#apierrors_401__401_notauthenticated for more information about resolving this error
Also see https://docs.oracle.com/iaas/api/#/en/identity/20160918/AvailabilityDomain/ListAvailabilityDomains for details on this operation's requirements.
To get more info on the failing request, you can enable debug level logs as mentioned in `Using SLF4J for Logging section` in https://docs.oracle.com/en-us/iaas/Content/API/SDKDocs/javasdkconfig.htm.
If you are unable to resolve this Identity issue, please contact Oracle support and provide them this full error message.
	at com.oracle.bmc.http.internal.ClientCall.lambda$checkError$18(ClientCall.java:816)
	at java.base/java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:934)
	at java.base/java.util.concurrent.CompletableFuture.uniHandleStage(CompletableFuture.java:950)
	at java.base/java.util.concurrent.CompletableFuture.handle(CompletableFuture.java:2372)
	at java.base/java.util.concurrent.CompletableFuture.handle(CompletableFuture.java:144)
	at com.oracle.bmc.http.internal.ClientCall.checkError(ClientCall.java:772)
	at com.oracle.bmc.http.internal.ClientCall.transformResponse(ClientCall.java:637)
	at com.oracle.bmc.http.internal.ClientCall.lambda$callAsyncImpl$24(ClientCall.java:1021)
	at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150)
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
	at com.oracle.bmc.http.internal.SyncFutureWaiter$Waiter.waitAndWork(SyncFutureWaiter.java:63)
	at com.oracle.bmc.http.internal.SyncFutureWaiter.listenForResult(SyncFutureWaiter.java:32)
	at com.oracle.bmc.http.internal.ClientCall.callSync(ClientCall.java:1089)
	at com.oracle.bmc.identity.IdentityClient.listAvailabilityDomains(IdentityClient.java:2543)
	at org.example.Main.getAvailabilityDomains(Main.java:278)
	at org.example.Main.main(Main.java:179)

The key provided is for sure a valid one as I it has been obtained via OCI user interface and I tested it with another SDK. In the above stack trace I removed my compartmentID as that is sensitive information to publish.

Can you please provide a solution to this?

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant