When using the Java SDK, I start the connection and it works fine for a while. But then eventually I get a message like this:
com.cisco.thunderhead.errors.UnauthorizedRestApiException: null: RestApiError with errorType: unAuthorized, errorData: NonBlockingOAuthClient expired token, errorMessage: Oauth token has expired and could not be refreshed
Is there a keepalive method I should be calling to keep the Oauth token from timing out? Or to request a new token?
While you initialize SDK, SDK should start a thread to renew your OAuth token every hour. Token you get is valid for 2 hors but is refreshed every hour. You should not have to take extra steps for this. Seems like either SDK failed to start refresh thread of refresh token fails.
Did you see this error after 1 hour of using SDK or after 2 hours?
Can you please send more logs so we can do some investigation for this issue?
Sorry for the delay in response. Based on logs, we see that you are trying to use both Context and Management connector from same JVM. This is not supported by Context Service. Each connector needs to be running from separate JVM.
Please refer to: Cisco DevNet: Context Service - Context Service SDK Guide
You cannot create both a management connection and client connection on the same Java virtual machine.
This line was added in the SDK Guide after you raised an issue with expired OAuth token. After debugging, we updated the DOC to indicate that running both connector on same JVM is not supported.
Context team should have reached out to you after our analysis. Again, I am sorry for the delay in response.