Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase init error in Google App Engine

I am now developing a java Google cloud endpoint in GAE. Inside the endpoint it will try to connect to the Firebase server to get some data.

However, when I create the Firebase object in my endpoint,

Firebase ref = new Firebase(<My Firebase URL>);

GAE throws the following error:

java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "modifyThreadGroup") 
    at java.security.AccessControlContext.checkPermission(AccessControlContext.java:382) 
    at java.security.AccessController.checkPermission(AccessController.java:572) 
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:549) 
    at java.lang.ThreadGroup.checkAccess(ThreadGroup.java:315) 
    at java.lang.Thread.init(Thread.java:391) 
    at java.lang.Thread.init(Thread.java:349) 
    at java.lang.Thread.<init>(Thread.java:675) 
    at java.util.concurrent.Executors$DefaultThreadFactory.newThread(Executors.java:572) 
    at com.firebase.client.utilities.DefaultRunLoop$FirebaseThreadFactory.newThread(DefaultRunLoop.java:25) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.<init>(ThreadPoolExecutor.java:600) 
    at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:943) 
    at java.util.concurrent.ThreadPoolExecutor.ensurePrestart(ThreadPoolExecutor.java:1635) 
    at java.util.concurrent.ScheduledThreadPoolExecutor.delayedExecute(ScheduledThreadPoolExecutor.java:307) 
    at java.util.concurrent.ScheduledThreadPoolExecutor.schedule(ScheduledThreadPoolExecutor.java:526) 
    at java.util.concurrent.ScheduledThreadPoolExecutor.execute(ScheduledThreadPoolExecutor.java:615) 
    at com.firebase.client.utilities.DefaultRunLoop.scheduleNow(DefaultRunLoop.java:57) 
    at com.firebase.client.core.Repo.scheduleNow(Repo.java:176) 
    at com.firebase.client.core.Repo.<init>(Repo.java:58) 
    at com.firebase.client.core.RepoManager.getLocalRepo(RepoManager.java:46) 
    at com.firebase.client.core.RepoManager.getRepo(RepoManager.java:19) 
    at com.firebase.client.Firebase.<init>(Firebase.java:194) 
    at com.firebase.client.Firebase.<init>(Firebase.java:199) 
    at com.firebase.client.Firebase.<init>(Firebase.java:177)

I am using Firebase client 2.2.3. It seems like GAE does not allow an application to create new threads. Any idea?

like image 371
Tommy Siu Avatar asked Oct 20 '22 14:10

Tommy Siu


2 Answers

In the Java runtime for Google App Engine there are some restrictions on creating new threads.

Please see the Threads section for details.

like image 166
Mario Avatar answered Oct 23 '22 09:10

Mario


@ Mario is correct, App Engine app may not spawn new threads according to the docs.This is because the AppEngine application run in the sandbox environment in which you have some restrictions.If still you want to develop your app without out any restriction then I would suggest try Managed VM in which you don't have these types of restrictions.

like image 39
Shobhit Avatar answered Oct 23 '22 09:10

Shobhit