Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Apple M1上本地运行Java GAE标准应用程序时,云Firestore API调用不响应_Java_Google App Engine_Google Cloud Firestore_Firebase Admin_Apple M1 - Fatal编程技术网

在Apple M1上本地运行Java GAE标准应用程序时,云Firestore API调用不响应

在Apple M1上本地运行Java GAE标准应用程序时,云Firestore API调用不响应,java,google-app-engine,google-cloud-firestore,firebase-admin,apple-m1,Java,Google App Engine,Google Cloud Firestore,Firebase Admin,Apple M1,问题 我的Java后端应用程序使用Firebase Admin SDK调用云Firestore。应用程序在App Engine环境中正确运行,但在本地运行时,Firestore调用仍处于挂起状态,从未收到响应。 这个问题只发生在我的MacBook Air和Apple M1上,在Windows上我没有问题。 规格: // Create a reference to the collection CollectionReference collectionReference = FirestoreC

问题

我的Java后端应用程序使用Firebase Admin SDK调用云Firestore。应用程序在App Engine环境中正确运行,但在本地运行时,Firestore调用仍处于挂起状态,从未收到响应。 这个问题只发生在我的MacBook Air和Apple M1上,在Windows上我没有问题。

规格:

// Create a reference to the collection
CollectionReference collectionReference = FirestoreClient.getFirestore().collection(getCollectionPath());

// Create a query against the collection
DocumentReference documentReference = collectionReference.document(id);

ApiFuture<DocumentSnapshot> future = documentReference.get();

DocumentSnapshot documentSnapshot = future.get();
应用程序:RESTWeb服务,使用Java8,Jersey 2.29,Maven

IDE:IntelliJ IDEA-社区2021.1(对于本地delpoy,我遵循GCP)

OS:MacBookAir上的BigSur11.2.3和苹果M1

注意事项:

// Create a reference to the collection
CollectionReference collectionReference = FirestoreClient.getFirestore().collection(getCollectionPath());

// Create a query against the collection
DocumentReference documentReference = collectionReference.document(id);

ApiFuture<DocumentSnapshot> future = documentReference.get();

DocumentSnapshot documentSnapshot = future.get();
  • 当应用程序在本地运行时,应用程序指向Cloud Firestore,而不是 本地Firestore模拟器
  • 如果我在一个main方法中运行代码片段,那么它就可以完美地工作
代码片段:

// Create a reference to the collection
CollectionReference collectionReference = FirestoreClient.getFirestore().collection(getCollectionPath());

// Create a query against the collection
DocumentReference documentReference = collectionReference.document(id);

ApiFuture<DocumentSnapshot> future = documentReference.get();

DocumentSnapshot documentSnapshot = future.get();
…我得到这个错误:

java.util.concurrent.TimeoutException:等待com.google.api.core.AbstractApiFuture的时间为30000毫秒(加上6毫秒延迟)$InternalSettableFuture@627262b5[状态=待定]