As of April 12th, you must go to Progress SupportLink to create new support cases or to access existing cases. Please, bookmark the SupportLink URL and use the new portal to contact the support team.
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.
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:229)
at com.kinvey.java.core.KinveyClientRequestInitializer.initialize(KinveyClientRequestInitializer.java:98)
Any ideas why this might be the case?
1 Comment
E
Edward
said
over 9 years ago
Hey,
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.
tupakapoor
javaClient = new Client.Builder(auth.getAppId(), auth.getMasterSecret()).build();
javaClient.user().loginBlocking(auth.getAppId(), auth.getMasterSecret()).execute();
if (javaClient.user().isUserLoggedIn()) {
....
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.
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:229)
at com.kinvey.java.core.KinveyClientRequestInitializer.initialize(KinveyClientRequestInitializer.java:98)
Any ideas why this might be the case?