IllegalArgumentException in Core.initializeSession

0
Hi all, When we delete an account from the database and then try to login again. Then the account creation goes well, but when initializing the session we get an IllegalArgumentException (Reference values ​​can't be null). Now we have tried to debug where it goes wrong and what could be the cause. But we don't see anything crazy. We can't debug further in the code than the line session = Core.initializeSession(user, cookie); See the screenshots below.     The workaround is to restart the application. However, this isn’t workable for our testers. Does anyone have any idea what we can try or maybe even what's going wrong. Thanks for the support! Max
asked
1 answers
1

Looking at your code, I assume you are trying to initialize a session for user, before that, you want to check if any existing sessions are there for the user already. 

With the given information, Iam not really sure, where it goes wrong, but with the debugging information, it looks like the user does not have any role and may be when initializing the session, mendix expects the role to forward the user to right page. 

From what I know, if there is a session already for the user, Mendix will invalidate that session and creates a new one.

- For which simply, you can do Core.initializeSession(user, null);

If you want to look for existing sessions and check get the session id for that user, then you can use Core.getActiveSession(username); and later pass the session id to Core.initializeSession(user, <sessionid>);

Refer: https://apidocs.rnd.mendix.com/8/runtime/com/mendix/core/Core.html#getActiveSession(java.lang.String)

If this does not answer the question, post the entire stack trace

answered