When creating a custom event handler, instantiating a new instance of the class BackendlessDataQuery results in an AccessControlException being thrown.
@BackendlessEvent( "getUserLogin" )
public class GetUserLoginEventHandler extends com.backendless.servercode.extension.CustomEventHandler
{
private static final Logger log = Logger.getLogger( GetUserLoginEventHandler.class );
@Override
public Map handleEvent( RunnerContext context, Map eventArgs )
{
Map<String,String> retObj = new HashMap<>();
BackendlessDataQuery query = new BackendlessDataQuery("where clause");
//...
// add your code here
return retObj;
}
I suspect the error occurs because of the following line:
private static final Logger log = Logger.getLogger( GetUserLoginEventHandler.class );
Internally it creates a log buffer and allocates a thread which submits log messages back to Backendless. CodeRunner (currently) does not allow extra threads and you end up getting an exception. We’re making changes to allow an additional thread. Meanwhile, try the following workaround:
Add the following line before you get an instance of ILogger: