As the title says it, you're receiving an Access denied: [ClassName] when you try to run some process in AX. In my case the scenario context was testing a custom AX Security Role.
The security role had only a few entry points, and even checking with the AX Security Tool the necessary permissions of the entire process callstack, the menu items that were leading to the calls of the class were added as Entry Points, so for sure that was not it (of course the class was called sometime along the path of the process by using a new MenuFunction). After debugging for a while, I realized the obvious: the class was a SysOperationServiceController class and it was failing right at the point of trying to create the DataContract which is done by reflection on the service operation method; that will call, among others, the checkAccess method.
Success. What you have to do in order to fix the issue is to add to the Ax Security Role (or to a Privilege) in the Server Methods node the service operation method (you will notice that you have to key in your method's name and not press Enter but instead navigate down with the arrow, as the IDE will not validate it as a proper method name, still it will work).
The code that throws the error, in the SysOperationController class:
/// Microsoft internal use only.
public void checkAccess()
throw error(strFmt("@SYS316844", classId2Name(classIdGet(this))));