gpt4 book ai didi

java.lang.IllegalStateException : Failed to initialize a GAE background thread factory

转载 作者:行者123 更新时间:2023-11-30 06:40:13 25 4
gpt4 key购买 nike

当我尝试让 firebase 数据库引用时出现此错误。

java.lang.IllegalStateException:无法初始化 GAE 后台线程工厂

如果我获取的数据库引用不正确,请告诉我。

提前致谢。

try {
FileInputStream serviceAccount = new FileInputStream("abcd.json");

FirebaseOptions options = new FirebaseOptions.Builder()
.setCredential(FirebaseCredentials.fromCertificate(serviceAccount))
.setDatabaseUrl("https://abc.firebaseio.com/").build();

FirebaseApp.initializeApp(options);


} catch (FileNotFoundException e) {
System.out.println("ERROR: FileNotFoundException :invalid service account credentials. See README.");
System.out.println(e.getMessage());

} catch (IOException e) {
System.out.println("ERROR: IOException : invalid service account credentials. See README.");
System.out.println(e.getMessage());
}

DatabaseReference defaultDBRef = FirebaseDatabase.getInstance().getReference();

最佳答案

尝试使用手动扩展(检查您的免费配额!)。 firebase-admin-sdk 在处理线程时存在问题。

文档状态:

We recommend that even Java backends use the REST API for Firebase, due to known issues with restarting App Engine threads running the Firebase Java SDK.

请参见此处:https://cloud.google.com/solutions/using-firebase-real-time-events-app-engine

关于java.lang.IllegalStateException : Failed to initialize a GAE background thread factory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44478399/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com