[Going through old notes in my retail folder and posting here]
I was attempting to run a Retail Data Distribution job in AX 2012 R3 to a POS and got the below error. It was 'Failed to create a session; confirm that the user has the proper privileges to log on to Microsoft Dynamics'. I recently ran the generate classes and create staging tables functions so there was new code in place.
I did a little debugging as the error was not retail specific and it was odd it was being thrown where it was. Sure enough, the CIL wasn't recognizing my current user which is why it wasn't working... Obviously this isn't a bug but rather something within AX. Come to find out, I had previously built the classes and staging tables for the jobs in the USR layer, deleted them, then rebuilt them in the proper layer/model. That threw some issues into the system.
A compile, usage data clear allowed me to get the new error in Figure 3. Obviously that told me to do a full CIL build. I did that, problem solved!
Figure 1 - The error in question
Figure 2 - Line 51 is where the error was being thrown.
Figure 3 - The actual error in question. Its actually quite helpful!