Firebase数据库与Java服务器的连接引发`InvocationTargetException`

Firebase数据库与Java服务器的连接引发`InvocationTargetException`,java,firebase,firebase-realtime-database,Java,Firebase,Firebase Realtime Database,我正在尝试从Java服务器连接到firebase数据库。当我从FirebaseDatabase对象获取任何引用时,它会抛出InvocationTargetException 错误日志跟踪: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at com.google.firebase.database.core.GaePlatform.getGaeThreadFactory(GaePlatfor

我正在尝试从Java服务器连接到firebase数据库。当我从
FirebaseDatabase
对象获取任何引用时,它会抛出
InvocationTargetException

错误日志跟踪:

java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at com.google.firebase.database.core.GaePlatform.getGaeThreadFactory(GaePlatform.java:67)
    at com.google.firebase.database.core.GaePlatform.isActive(GaePlatform.java:78)
    at com.google.firebase.database.core.Context.getPlatform(Context.java:42)
    at com.google.firebase.database.core.Context.ensureLogger(Context.java:211)
    at com.google.firebase.database.core.Context.initServices(Context.java:77)
    at com.google.firebase.database.core.Context.freeze(Context.java:64)
    at com.google.firebase.database.core.RepoManager.createLocalRepo(RepoManager.java:78)
    at com.google.firebase.database.core.RepoManager.createRepo(RepoManager.java:28)
    at com.google.firebase.database.FirebaseDatabase.ensureRepo(FirebaseDatabase.java:249)
    at com.google.firebase.database.FirebaseDatabase.getReference(FirebaseDatabase.java:125)
    at com.hw.service.impl.AppServiceImpl.repopulateCounsellors(AppServiceImpl.java:161)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:333)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:190)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
    at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)
    at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:213)
    at com.sun.proxy.$Proxy57.repopulateCounsellors(Unknown Source)
    at com.hw.controller.AppController.repopulateCounsellors(AppController.java:70)
嵌套异常:

Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.google.firebase.database.core.GaePlatform.getGaeThreadFactory(GaePlatform.java:62)
... 60 more
Caused by: java.lang.NullPointerException
    at com.google.appengine.api.ThreadManager.backgroundThreadFactory(ThreadManager.java:72)
下面代码的第3行出现错误
fireDB.getReference

FirebaseDatabase fireDB = FirebaseDatabase.getInstance(firebaseApp);
System.out.println(fireDB);
DatabaseReference ref = fireDB.getReference("/users");
System.out.println("db counsellor ref : " + ref);
System.out.println("db ref key : " + ref.getKey());
我正在为我的java服务器使用SpringMVC
firebaseApp
自动连接并在配置类中初始化为:

        String firebaseJson = env.getProperty("firebase.credentials");
        String fireDb = env.getProperty("firebase.db");
        FirebaseOptions options = new FirebaseOptions.Builder()
                .setServiceAccount(new FileInputStream(firebaseJson))
                .setDatabaseUrl(fireDb)
                .build();
        return FirebaseApp.initializeApp(options);

我不知道哪里出错了

InvocationTargetException应该有一个嵌套异常。也向我们显示stacktrace。添加了嵌套异常日志^I尝试为我的GAE firebase客户端编写集成测试时遇到了相同的问题。它看起来像是一个bug-Firebase在检查GAE是否处于活动状态时崩溃,但当它这样做时,它似乎试图获得GAE线程工厂,并且可能崩溃。相当令人失望的是,Firebase工程师在近3个月内没有做出回应。我遇到了类似的问题:同一个问题,有人解决了吗?