Java Firebase连接在SpringBoot中的Linux上不工作

Java Firebase连接在SpringBoot中的Linux上不工作,java,linux,spring,firebase-realtime-database,kotlin,Java,Linux,Spring,Firebase Realtime Database,Kotlin,我试图实现的是打开到firebase数据库的连接,并获取一些需要解析的数据。我使用Spring启动框架运行Spring,firebase、kotlin和gradle的管理sdk。在Windows10上,它工作正常,但当我尝试在linux服务器上运行.jar文件时,它没有得到任何数据或错误。它在ValueEventListener上卡住了。我安装了ufw,但禁用它或添加端口5228:5230(tcp/udp)并不能解决问题 val dataMinifiedRef = database.re

我试图实现的是打开到firebase数据库的连接,并获取一些需要解析的数据。我使用Spring启动框架运行Spring,firebase、kotlin和gradle的管理sdk。在Windows10上,它工作正常,但当我尝试在linux服务器上运行.jar文件时,它没有得到任何数据或错误。它在ValueEventListener上卡住了。我安装了ufw,但禁用它或添加端口5228:5230(tcp/udp)并不能解决问题

    val dataMinifiedRef = database.reference.child("minifiedData").child("areas")
    dataMinifiedRef.addListenerForSingleValueEvent(object : ValueEventListener {
        override fun onCancelled(error: DatabaseError?) {
            log.info(error!!.message)
        }

        override fun onDataChange(dataSnapshot: DataSnapshot) {
            log.info("Got data")
        }
    })
编辑: 这就是我解析服务帐户的方式

    val str = "{\n" +
              ...
              "}\n"

    // convert String into InputStream
    val serviceAccount = ByteArrayInputStream(str.toByteArray())

    val options = FirebaseOptions.Builder()
            .setCredentials(GoogleCredentials.fromStream(serviceAccount))
            .setDatabaseUrl("https://xxx.firebaseio.com")
            .build()
我得到以下错误

Tue Dec 19 15:31:41 CET 2017 [DEBUG] com.google.firebase.database.connection.PersistentConnection‌​: pc_0 - Trying to fetch auth token 
Tue Dec 19 15:31:41 CET 2017 [DEBUG] com.google.firebase.database.connection.PersistentConnection‌​: pc_0 - Error fetching token: java.io.IOException: Error getting access token for service account:

问题是Linux服务器上的时间没有自动同步。我在他提到解决方案的地方发现了这一点。然后,我按照这一点添加了与我们的服务器位置相同的NTP服务器。

很难说出哪里出了问题。但是如果你可能在输出中得到一条线索。它会给你日志“得到数据”?不,没有日志showing@FrankvanPuffelen我将loglevel设置为debug,现在firebase将此设置为:
2017年12月19日星期二15:31:41 CET[debug]com.google.firebase.database.connection.PersistentConnection:pc_0-尝试获取身份验证令牌(2017年12月19日星期二15:31:41[DEBUG]com.google.firebase.database.connection.PersistentConnection:pc_0-获取令牌时出错:java.io.IOException:获取服务帐户的访问令牌时出错:
。我有一个字符串形式的service_帐户,我用ByteArrayInputStream解析它。我认为这是可行的,但我假设它不能连接到firebase本身?