So i am logging in as the "master user" and making sure I have a logged in user . However, later on in the same script's execution occasionally I will get a NullPointerException when trying to run a query against the data store:
java.lang.NullPointerException: No Active User - please login a user by calling myClient.user().login( ... ) before retrying this request.
Any ideas why this might be the case?
about 4 years ago
The Java library uses an in-memory implementation for storing credentials, which is referenced from the Client. I'm wondering if it is possible that the client is getting garbage collected at any point? How are you maintaining the reference to the Client? Also, are you calling `javaClient.User().Logout().Execute()` at any point?
As a temporary workaround, you can wrap access to the client behind a `getClient()` method, which will check if it's logged in, and if it's not perform a login operation.