我在应用程序中使用Firestore,并且在方法调用时使用
PASS src/stackoverflow/53934331/authService.spec.ts
authService
#postAuthUser
✓ login user (5ms)
----------------|----------|----------|----------|----------|-------------------|
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s |
----------------|----------|----------|----------|----------|-------------------|
All files | 100 | 100 | 100 | 100 | |
authService.ts | 100 | 100 | 100 | 100 | |
----------------|----------|----------|----------|----------|-------------------|
Test Suites: 1 passed, 1 total
Tests: 1 passed, 1 total
Snapshots: 0 total
Time: 3.483s, estimated 4s
获取异常:
Firestore firstoreDB = FirestoreClient.getFirestore(FirebaseApp.getInstance(env));
我知道是依赖项不匹配,并尝试了firebase admin和firestore + guava版本的所有排列,但没有运气。
我当前的POM是:
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.google.cloud.firestore.v1beta1.stub.GrpcFirestoreStub.<clinit>(GrpcFirestoreStub.java:73)
at com.google.cloud.firestore.spi.v1beta1.GrpcFirestoreRpc.<init>(GrpcFirestoreRpc.java:133)
at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreRpcFactory.create(FirestoreOptions.java:80)
at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreRpcFactory.create(FirestoreOptions.java:72)
at com.google.cloud.ServiceOptions.getRpc(ServiceOptions.java:512)
at com.google.cloud.firestore.FirestoreOptions.getFirestoreRpc(FirestoreOptions.java:315)
at com.google.cloud.firestore.FirestoreImpl.<init>(FirestoreImpl.java:76)
at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreFactory.create(FirestoreOptions.java:63)
at com.google.cloud.firestore.FirestoreOptions$DefaultFirestoreFactory.create(FirestoreOptions.java:56)
at com.google.cloud.ServiceOptions.getService(ServiceOptions.java:499)
at com.google.firebase.cloud.FirestoreClient.<init>(FirestoreClient.java:47)
at com.google.firebase.cloud.FirestoreClient.<init>(FirestoreClient.java:27)
at com.google.firebase.cloud.FirestoreClient$FirestoreClientService.<init>(FirestoreClient.java:87)
at com.google.firebase.cloud.FirestoreClient.getInstance(FirestoreClient.java:77)
at com.google.firebase.cloud.FirestoreClient.getFirestore(FirestoreClient.java:70)
at com.mmt.app.firebase.ConnectToAgent.sendMessage(ConnectToAgent.java:94)
at com.mmt.app.firebase.TestFB.connectToAgent(TestFB.java:37)
at com.mmt.app.firebase.TestFB.main(TestFB.java:19)
Caused by: java.lang.ClassNotFoundException: com.google.protobuf.GeneratedMessageV3
at java.net.URLClassLoader.findClass(Unknown Source)